Skip to content

Instantly share code, notes, and snippets.

@sardaukar
Created June 26, 2018 17:01
Show Gist options
  • Save sardaukar/b19fdf959470f9e7d07158b7f7e7f930 to your computer and use it in GitHub Desktop.
Save sardaukar/b19fdf959470f9e7d07158b7f7e7f930 to your computer and use it in GitHub Desktop.
.envrc multi-env
context=
[[ -f .envrc.context ]] && context=$(< .envrc.context)
watch_file ".envrc.context"
RED='\033[0;31m'
LBLUE='\033[1;34m'
NC='\033[0m'
if [[ -n "$context" ]]; then
context_file=".envrc.$context"
if [[ -f "$context_file" ]]; then
echo -e "Loading ${LBLUE}$context${NC} context\n"
source_env "$context_file"
else
echo "$context_file missing"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment