Skip to content

Commit

Permalink
fix: Update environment variable handling in Supervisor configuration…
Browse files Browse the repository at this point in the history
… scripts
  • Loading branch information
MrAnyx committed Jan 4, 2025
1 parent 6dc2fd9 commit 2e744cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 2 additions & 3 deletions .docker/entrypoint.dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ set -e

echo "Generating Supervisor configuration..."
SUPERVISORD_CONF="/etc/supervisor/conf.d/supervisord.conf"
ENV_VARS=$(printenv | awk -F= '{print $1"=\""$2"\""}' | tr '\n' ',' | sed 's/,$//')
ESCAPED_ENV_VARS=$(echo "$ENV_VARS" | sed 's/"/\\"/g')
ENV_VARS=$(printenv | awk -F= '{print $1"=\""$2"\","}' | tr -d '\n' | sed 's/,$//')
echo "" >> $SUPERVISORD_CONF
echo "[supervisord]" >> $SUPERVISORD_CONF
echo "nodaemon=true" >> $SUPERVISORD_CONF
echo "logfile=/dev/null" >> $SUPERVISORD_CONF
echo "logfile_maxbytes=0" >> $SUPERVISORD_CONF
echo "environment=${ESCAPED_ENV_VARS}" >> $SUPERVISORD_CONF
echo "environment=${ENV_VARS}" >> $SUPERVISORD_CONF

# Update and start supervisor service
echo "Starting supervisor..."
Expand Down
7 changes: 4 additions & 3 deletions .docker/entrypoint.prod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ echo "Running database migrations..."
php bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration

# Generate Supervisor configuration


echo "Generating Supervisor configuration..."
SUPERVISORD_CONF="/etc/supervisor/conf.d/supervisord.conf"
ENV_VARS=$(printenv | awk -F= '{print $1"=\""$2"\""}' | tr '\n' ',' | sed 's/,$//')
ESCAPED_ENV_VARS=$(echo "$ENV_VARS" | sed 's/"/\\"/g')
ENV_VARS=$(printenv | awk -F= '{print $1"=\""$2"\","}' | tr -d '\n' | sed 's/,$//')
echo "" >> $SUPERVISORD_CONF
echo "[supervisord]" >> $SUPERVISORD_CONF
echo "nodaemon=true" >> $SUPERVISORD_CONF
echo "logfile=/dev/null" >> $SUPERVISORD_CONF
echo "logfile_maxbytes=0" >> $SUPERVISORD_CONF
echo "environment=${ESCAPED_ENV_VARS}" >> $SUPERVISORD_CONF
echo "environment=${ENV_VARS}" >> $SUPERVISORD_CONF

# Update and start supervisor service
echo "Starting supervisor..."
Expand Down

0 comments on commit 2e744cd

Please sign in to comment.