|
|
@ -49,17 +49,27 @@ srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
# or
|
|
|
|
# or
|
|
|
|
# gcloud config set --help
|
|
|
|
# gcloud config set --help
|
|
|
|
|
|
|
|
|
|
|
|
if [ -z "${CI:-}" ]; then
|
|
|
|
gcloud_config(){
|
|
|
|
config=dev
|
|
|
|
local config="${1:-}"
|
|
|
|
# protect from setting this if the config does exist
|
|
|
|
if [ -z "$config" ]; then
|
|
|
|
# - not needed, it'll only affect the view in
|
|
|
|
echo "no config passed to gcloud_config() function" >&2
|
|
|
|
# 'gcloud config configurations list'
|
|
|
|
return 1
|
|
|
|
# but the last settings will still be in effect so shouldn't mess up anybody GCloud SDK CLI if set to the wrong thing
|
|
|
|
fi
|
|
|
|
# so save the extra fork
|
|
|
|
if [ -z "${CI:-}" ]; then
|
|
|
|
#if gcloud config configurations list --format='get(name)' | grep -q "^$config$"; then
|
|
|
|
return
|
|
|
|
export CLOUDSDK_ACTIVE_CONFIG_NAME="$config"
|
|
|
|
fi
|
|
|
|
#fi
|
|
|
|
# don't waste time if not using GCloud SDK, ie. not found in $PATH
|
|
|
|
fi
|
|
|
|
if type -P gcloud; then
|
|
|
|
|
|
|
|
# protect from setting this if the config does exist as this can cause auth problems by unsetting the core.account
|
|
|
|
|
|
|
|
if gcloud config configurations list --format='get(name)' | grep -q "^$config$"; then
|
|
|
|
|
|
|
|
export CLOUDSDK_ACTIVE_CONFIG_NAME="$config"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#gcloud_config dev
|
|
|
|
|
|
|
|
#gcloud_config staging
|
|
|
|
|
|
|
|
#gcloud_config production
|
|
|
|
|
|
|
|
|
|
|
|
# XXX: Edit
|
|
|
|
# XXX: Edit
|
|
|
|
export CLOUDSDK_CORE_PROJECT=myproject
|
|
|
|
export CLOUDSDK_CORE_PROJECT=myproject
|
|
|
|