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

This commit is contained in:
Ibrahim authored and GitHub committed 2025-01-10 12:01:15 -05:00
1 parent ee76912fed
commit a2d34c97ed
1 file changed
+20 -10
+20 -10
View File
@@ -7,20 +7,30 @@ if [ -n "$SSL_PORT" ]
envsubst '${PORT}' < /usr/src/default.conf.template > /etc/nginx/conf.d/default.conf
fi
if [ -n "$APP_CONFIG" ] ; then
if [ -n "$APP_CONFIG" ]; then
echo "$APP_CONFIG" > /usr/share/nginx/html${PUBLIC_URL}app-config.js
# Removes the old compressed app-config file, then compresses the replacement
# and finally creates a new empty file so that gunzip works correctly.
# This code is correct despite the AI warning otherwise about order of create/delete
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
echo "Using custom APP_CONFIG environment variable"
else
echo "Not using custom APP_CONFIG"
fi
if [ ! -n "$APP_CONFIG" ]
then
echo "Not using custom app config"
if [ -f /usr/share/nginx/html${PUBLIC_URL}app-config.js ]; then
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
if [ -n "$CLIENT_ID" ] || [ -n "$HEALTHCARE_API_ENDPOINT" ]
then
# If CLIENT_ID is specified, use the google.js configuration with the modified ID