Skip to content

Commit 08199d9

Browse files
committed
environment configuration for ecscli
1 parent 34c52cd commit 08199d9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

master_deploy.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ template=""
4141
TEMPLATE_SKELETON_FILE="base_template_v2.json"
4242
APP_IMAGE_NAME=""
4343
DEPLOYCATEGORY=""
44+
ECSCLI_ENVFILE="api.env"
4445

4546
#variable specific to EBS
4647
DOCKERRUN="Dockerrun.aws.json"
@@ -160,6 +161,27 @@ ECSCLI_push_ecr_image() {
160161
log "Docker Image published."
161162
}
162163
#================
164+
ECSCLI_update_env()
165+
{
166+
Buffer_seclist=$(echo $SEC_LIST | sed 's/,/ /g')
167+
for listname in $Buffer_seclist;
168+
do
169+
local o=$IFS
170+
IFS=$(echo -en "\n\b")
171+
envvars=$( cat $listname.json | jq -r ' . ' | jq ' . | to_entries[] | { "name": .key , "value": .value } ' | jq -s . )
172+
log "vars are fetched"
173+
174+
for s in $(echo $envvars | jq -c ".[]" ); do
175+
#echo $envvars
176+
varname=$(echo $s| jq -r ".name")
177+
varvalue=$(echo $s| jq -r ".value")
178+
envaddition "$varname" "$varvalue"
179+
echo "$varname"="\"$varvalue\"" >>$ECSCLI_ENVFILE
180+
done
181+
IFS=$o
182+
done
183+
}
184+
#================
163185
portmapping() {
164186
hostport=$1
165187
containerport=$2
@@ -893,6 +915,8 @@ then
893915
exit 1
894916
fi
895917
fi
918+
#env file updation
919+
ECSCLI_update_env
896920
# Configurong cluster
897921
ecs-cli configure --region us-east-1 --cluster $AWS_ECS_CLUSTER
898922
# updating service

0 commit comments

Comments
 (0)