Skip to content

Instantly share code, notes, and snippets.

@blech75
Created August 17, 2020 15:18
Show Gist options
  • Save blech75/f2fea651da96c2194a249340800eabf3 to your computer and use it in GitHub Desktop.
Save blech75/f2fea651da96c2194a249340800eabf3 to your computer and use it in GitHub Desktop.
gaedev: pass env vars from .env to dev_appserver.py
function gaedev() {
env_vars_args=""
if [ -f '.env' ]; then
echo "> Using .env file:"
# indent the env to look nicer
perl -pe's/^/ /' <.env
echo
env_vars_args=$(perl -pe's/^(export )?/--env_var /' <.env | perl -pe's/\n/ /')
else
echo "> No .env file found."
echo
fi
cmd="dev_appserver.py . --enable_console --log_level=debug --storage_path=/tmp/dev_appserver.$(basename $(pwd)) ${env_vars_args} $*"
echo "${cmd}"
echo
$cmd
}
export -f gaedev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment