Skip to content

Commit

Permalink
Merge pull request #72 from cfortier2/feature/migration-script
Browse files Browse the repository at this point in the history
Update to handle no `CFG_` variables
  • Loading branch information
Bryan Latten committed Oct 30, 2015
2 parents d34253b + f86444a commit d45ed40
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
FROM behance/docker-nginx:1.2.4
MAINTAINER Bryan Latten <[email protected]>

# Set TERM to suppress warning messages.
ENV TERM=xterm-256color

# Install pre-reqs for the next steps
RUN apt-get update && apt-get -yq install \
build-essential \
Expand Down
25 changes: 16 additions & 9 deletions container/root/run.d/02-env.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
#!/bin/bash

# Adds docker environment variables where entering them as PHP-FPM environment variables
VARS=`env | grep ^CFG_`;
DEST_CONF=/etc/php5/fpm/pool.d/www.conf
# Check if there are environment variables prefixed with `CFG_`.
if [[ $(env | grep ^CFG_ | wc -l) -ne 0 ]]
then
# Adds docker environment variables where entering them as PHP-FPM environment variables
VARS=`env | grep ^CFG_`
DEST_CONF=/etc/php5/fpm/pool.d/www.conf

echo '[env] importing environment variables (prefixed by CFG_)'
for p in $VARS
do
ENV='env['${p/=/] = \"}\"
echo $ENV >> $DEST_CONF
done
echo '[env] importing environment variables (prefixed by CFG_)'
for p in $VARS
do
ENV='env['${p/=/] = \"}\"
echo $ENV >> $DEST_CONF
done

else
echo "[env] There were no environment variables found prefixed by CFG_"
fi

0 comments on commit d45ed40

Please sign in to comment.