Created
February 10, 2016 16:38
-
-
Save adrian7/96940b05ce8526da9ae3 to your computer and use it in GitHub Desktop.
Copies environment variables strarting with prefixes_ to php-fpm pool.conf file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Append Container variables to PHP-FPM pool configuration ### | |
PHP5_CONFIG_FILE=/etc/php5/fpm/pool.d/www.conf | |
echo "" >> $PHP5_CONFIG_FILE; | |
echo ";container environment variables" >> $PHP5_CONFIG_FILE; | |
SAVEIFS=$IFS | |
IFS=$(echo -en "\n\b") | |
for i in $(env) | |
do | |
variable=$(echo "$i" | cut -d'=' -f1) | |
value=$(echo "$i" | cut -d'=' -f2) | |
if [[ $variable == ENV_* ]] || [[ $variable == AWS_* ]] || [[ $variable == APP_* ]] || [[ $variable == PHP_* ]] ; | |
then | |
#Append variable to PHP5 www.conf file | |
echo "env[$variable] = \"$value\"" >> $PHP5_CONFIG_FILE; | |
fi | |
done | |
IFS=$SAVEIFS | |
### Append Container variables to PHP-FPM pool configuration ### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment