mirror of https://github.com/samply/bridgehead.git
Whenever a variable has the value <VAULT>, auto-fetch value from vault.
This commit is contained in:
parent
2b4ea24b59
commit
d428f08d8a
|
@ -46,6 +46,7 @@ source /etc/bridgehead/site.conf
|
||||||
case "$ACTION" in
|
case "$ACTION" in
|
||||||
start)
|
start)
|
||||||
checkRequirements
|
checkRequirements
|
||||||
|
fetchVarsFromVault /etc/bridgehead/site.conf /etc/bridgehead/$PROJECT.env
|
||||||
exec docker-compose -f ./$PROJECT/docker-compose.yml --env-file /etc/bridgehead/$PROJECT.env up
|
exec docker-compose -f ./$PROJECT/docker-compose.yml --env-file /etc/bridgehead/$PROJECT.env up
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
|
|
|
@ -23,3 +23,21 @@ checkRequirements() {
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fetchVarsFromVault() {
|
||||||
|
VARS_TO_FETCH=""
|
||||||
|
|
||||||
|
for line in $(cat $@); do
|
||||||
|
if [[ $line =~ .*=\<VAULT\>.* ]]; then
|
||||||
|
VARS_TO_FETCH+="$(echo -n $line | sed 's/=.*//') "
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$VARS_TO_FETCH" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval $(docker run --rm -ti -e BW_MASTERPASS -e BW_CLIENTID -e BW_CLIENTSECRET bwcli $VARS_TO_FETCH | sed 's/\r//g')
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue