Skip to content

Instantly share code, notes, and snippets.

@statianzo
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save statianzo/8ee6aaaba490947acaa3 to your computer and use it in GitHub Desktop.
Save statianzo/8ee6aaaba490947acaa3 to your computer and use it in GitHub Desktop.
Run a command in the same environment as a cloud66 stack
#!/bin/bash
set -eo pipefail
usage(){
echo "Usage: cxenv stack environment [command]"
exit 1
}
[ $# -lt 3 ] && usage
stack=$1
shift 1
environment=$1
shift 1
vars=$(cx env-vars -s $stack -e $environment | sed 1d | awk -F ' ' '{print $1 "=" "\"" $2 "\""}' | tr '\n' ' ')
env "${vars}" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment