From 7c1aaa97f831be04ecf7f35ca06237783d737e01 Mon Sep 17 00:00:00 2001 From: Sean Pearce Date: Thu, 3 Jan 2019 19:09:22 -0800 Subject: [PATCH] Expose env vars for config to PHP-FPM --- manifest/entrypoint.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/manifest/entrypoint.sh b/manifest/entrypoint.sh index 02d2486..58bc48c 100644 --- a/manifest/entrypoint.sh +++ b/manifest/entrypoint.sh @@ -13,5 +13,10 @@ fi procs=$(cat /proc/cpuinfo | grep processor | wc -l) sed -i -e "s/worker_processes 5/worker_processes $procs/" /etc/nginx/nginx.conf +# Copy important env vars for PHP-FPM to access +PHP_ENV_FILE="/usr/etc/php-fpm.d/${PHP_ENV_FILE:-env.conf}" +echo '[www]' > "$PHP_ENV_FILE" +env | grep -e 'REPORT_DB_HOST' -e 'REPORT_DB_NAME' -e 'REPORT_DB_USER' -e 'REPORT_DB_PASS' | sed "s/\(.*\)=\(.*\)/env[\1]='\2'/" >> "$PHP_ENV_FILE" + # Start supervisord and services /usr/bin/supervisord -n -c /etc/supervisord.conf