Created
June 23, 2015 13:41
-
-
Save shortjared/b21ae9a0c1b233adc31d to your computer and use it in GitHub Desktop.
S3 Sourced Config Example
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
apt-get install -y zip unzip && \ | |
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" && \ | |
unzip awscli-bundle.zip && \ | |
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws |
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
#!/bin/bash | |
# Usage is by setting the GLOBAL_CONFIG environment variable | |
# and/or the APP_CONFIG environment variable | |
# Global environment configuration | |
if [ -z "$GLOBAL_CONFIG" ]; then | |
echo "No configuration file was defined. To define this, pass in the GLOBAL_CONFIG environment variable." | |
else | |
echo "Configuration file was set to $GLOBAL_CONFIG" | |
echo "Setting global environment variables from S3." | |
while read line; do export "$line"; | |
done < <(aws s3 cp s3://$GLOBAL_CONFIG -) | |
echo "Global environment setup complete." | |
fi | |
# App specific configuration | |
if [ -z "$APP_CONFIG" ]; then | |
echo "No app specicific configuration file was defined. To define this, pass in the APP_CONFIG environment variable." | |
else | |
echo "Configuration file was set to $APP_CONFIG" | |
echo "Setting app specific environment variables from S3." | |
while read line; do export "$line"; | |
done < <(aws s3 cp s3://$APP_CONFIG -) | |
echo "App environment setup complete." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment