11#! /bin/bash
2- version=" 0.1.9 "
2+ version=" 0.1.10 "
33echo " Fixing configs...(fixconfig.sh v$version )"
44# Ensure right number of params
55if [ $# -lt 5 ]; then
@@ -24,7 +24,6 @@ myappuser=$4
2424myapppwd=$5
2525myrunid=$6
2626myurl=$7
27- err=' Success'
2827[ -z " $RG_HOME " ] && RG_HOME=' /opt/deploy/sp2'
2928echo " RG_HOME=$RG_HOME "
3029[ -z " $RG_SRC " ] && RG_SRC=' /home/ubuntu'
@@ -49,10 +48,8 @@ echo "Instance-id : $instanceid"
4948if [ -z " $myurl " ]; then
5049 public_host_name=" $( wget -q -O - http://169.254.169.254/latest/meta-data/public-hostname) "
5150 if [ -z " $public_host_name " ]; then
52- echo " ERROR: No RG URL passed. Instance does not have public hostname. One of the two is required. Not modifying configs."
53- baseurl=' '
54- snsprotocol=' '
55- err=' Error'
51+ echo " FATAL: No RG URL passed. Instance does not have public hostname. One of the two is required. Not modifying configs."
52+ exit 1
5653 else
5754 baseurl=" http://$public_host_name /"
5855 snsprotocol=" http"
@@ -153,17 +150,9 @@ aws s3 cp s3://${S3_SOURCE}/docker-compose.yml $RG_SRC
153150echo " Copying docker-compose.yml from $RG_SRC to $RG_HOME "
154151# trunk-ignore(shellcheck/SC2016)
155152repcmd=' s#\${PWD}#' $RG_HOME ' #'
153+ echo " Modifying docker-compose.yml"
156154sed -e " $repcmd " " $RG_SRC /docker-compose.yml" > " $RG_HOME /docker-compose.yml"
157- cd $RG_HOME || exit 1
158- if [ -f docker-compose.yml ]; then
159- echo " docker-compose.yml exists"
160- sed -i -e " s/REDIS_HOST.*/REDIS_HOST=$myip /" docker-compose.yml
161- sed -i -e " s/APP_ENV.*/APP_ENV=$RG_ENV /" docker-compose.yml
162- echo " Modified docker-compose.yml with APP_ENV=$RG_ENV and REDIS_HOST=$myip "
163- fi
155+ sed -i -e " s/REDIS_HOST.*/REDIS_HOST=$myip /" -e " s/APP_ENV.*/APP_ENV=$RG_ENV /" " $RG_HOME /docker-compose.yml"
156+ echo " Modified docker-compose.yml with APP_ENV=$RG_ENV and REDIS_HOST=$myip "
164157
165- if [ $err == ' Error' ]; then
166- echo ' Completed with Errors. Service may not work correctly. Please review the configuration files.'
167- else
168- echo ' Configuration changed successfully'
169- fi
158+ echo ' Configuration changed successfully'
0 commit comments