fix(docker): run compression regardless of APP_CONFIG being present ( in cases such as volume mount) (#4673)

This commit is contained in:
Ibrahim 2025-01-10 12:01:15 -05:00 committed by GitHub
parent ee76912fed
commit a2d34c97ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,20 +7,30 @@ if [ -n "$SSL_PORT" ]
envsubst '${PORT}' < /usr/src/default.conf.template > /etc/nginx/conf.d/default.conf envsubst '${PORT}' < /usr/src/default.conf.template > /etc/nginx/conf.d/default.conf
fi fi
if [ -n "$APP_CONFIG" ] ; then
if [ -n "$APP_CONFIG" ]; then
echo "$APP_CONFIG" > /usr/share/nginx/html${PUBLIC_URL}app-config.js echo "$APP_CONFIG" > /usr/share/nginx/html${PUBLIC_URL}app-config.js
# Removes the old compressed app-config file, then compresses the replacement echo "Using custom APP_CONFIG environment variable"
# and finally creates a new empty file so that gunzip works correctly. else
# This code is correct despite the AI warning otherwise about order of create/delete echo "Not using custom APP_CONFIG"
rm /usr/share/nginx/html${PUBLIC_URL}app-config.js.gz
gzip /usr/share/nginx/html${PUBLIC_URL}app-config.js
touch /usr/share/nginx/html${PUBLIC_URL}app-config.js
fi fi
if [ ! -n "$APP_CONFIG" ]
then if [ -f /usr/share/nginx/html${PUBLIC_URL}app-config.js ]; then
echo "Not using custom app config" if [ -s /usr/share/nginx/html${PUBLIC_URL}app-config.js ]; then
echo "Detected non-empty app-config.js. Ensuring .gz file is updated..."
rm -f /usr/share/nginx/html${PUBLIC_URL}app-config.js.gz
gzip /usr/share/nginx/html${PUBLIC_URL}app-config.js
touch /usr/share/nginx/html${PUBLIC_URL}app-config.js
echo "Compressed app-config.js to app-config.js.gz"
else
echo "app-config.js is empty. Skipping compression."
fi
else
echo "No app-config.js file found. Skipping compression."
fi fi
if [ -n "$CLIENT_ID" ] || [ -n "$HEALTHCARE_API_ENDPOINT" ] if [ -n "$CLIENT_ID" ] || [ -n "$HEALTHCARE_API_ENDPOINT" ]
then then
# If CLIENT_ID is specified, use the google.js configuration with the modified ID # If CLIENT_ID is specified, use the google.js configuration with the modified ID