adding scripts to populate ENV data into code
This commit is contained in:
23
start.sh
23
start.sh
@@ -1,4 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# start supervisord
|
||||
# Pull down code form git for our site!
|
||||
if [ ! -z "$GIT_REPO" ]; then
|
||||
rm /usr/share/nginx/html/*
|
||||
if [ ! -z "$GIT_BRANCH" ]; then
|
||||
git clone -b $GIT_BRANCH $GIT_REPO /usr/share/nginx/html/
|
||||
else
|
||||
git clone $GIT_REPO /usr/share/nginx/html/
|
||||
fi
|
||||
fi
|
||||
|
||||
# Very dirty hack to replace variables in code with ENVIRONMENT values
|
||||
|
||||
for i in $(env)
|
||||
do
|
||||
variable=$(echo "$i" | cut -d'=' -f1)
|
||||
value=$(echo "$i" | cut -d'=' -f2)
|
||||
if [[ "$variable" != '%s' ]] ; then
|
||||
replace='\$\$_'${variable}'_\$\$'
|
||||
find /usr/share/nginx/html -type f -exec sed -i -e 's/'${replace}'/'${value}'/g' {} \; ; fi
|
||||
done
|
||||
|
||||
# Start supervisord and services
|
||||
/usr/local/bin/supervisord -n
|
||||
|
||||
Reference in New Issue
Block a user