Created
November 23, 2011 11:31
-
-
Save brandonbloom/1388478 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
export APP_ENV=$1 | |
shift | |
if [ -z "$APP_ENV" ]; then | |
echo "Usage: $(basename $0) APP_ENV [ARGUMENTS...]" | |
echo "ARGUMENTS are forwarded to $(which env)" | |
exit 1 | |
fi | |
export APP_ROOT=/opt/myapp | |
if [ $APP_ENV = 'dev' ]; then | |
export APP_DEBUG=1 | |
else | |
export APP_DEBUG=0 | |
fi | |
# Your other configuration goes here! | |
exec env $* |
This file contains hidden or 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
Example usages: | |
appenv.sh dev /path/to/script -a -b -c | |
appenv.sh prod EXTRA_ARG=234 /path/to/server --port=1234 | |
appenv.sh dev > envs/dev | |
appenv.sh prod > envs/prod | |
diff envs/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment