Created
July 23, 2017 22:48
-
-
Save MrCoffey/ed734e0ef422260b9a5e346ace20230b to your computer and use it in GitHub Desktop.
Writes custom ENV variables into aws elastic beanstalk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
files: | |
"/opt/elasticbeanstalk/hooks/appdeploy/pre/02export_host_env_vars.sh": | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
#!/usr/bin/env bash | |
echo Defaults:root \!requiretty >> /etc/sudoers | |
for envvar in `jq '.optionsettings | {"aws:elasticbeanstalk:application:environment"}[] | .[]' /opt/elasticbeanstalk/deploy/configuration/containerconfiguration` | |
do | |
host_vars="${envvar//\"/}"; | |
host_vars="${host_vars/=/ }"; | |
sed -i "/ENV HOST_VARS inject_here/a ENV $host_vars" /var/app/current/Dockerfile | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment