Skip to content

Instantly share code, notes, and snippets.

@macdonst
Created April 22, 2019 19:00
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 macdonst/f7e17dbd61e950f0f6bbba8cf1b73073 to your computer and use it in GitHub Desktop.
Save macdonst/f7e17dbd61e950f0f6bbba8cf1b73073 to your computer and use it in GitHub Desktop.
function owenv() {
bold=$(tput bold)
normal=$(tput sgr0)
switches=""
space=$1
case "$space" in
"cloudshell")
host=runtime.adobe.io
key=<api key>
;;
"solutions")
host=runtime.adobe.io
key=<api key>
;;
"sensei")
host=runtime.adobe.io
key=<api key>
;;
"smacdona")
host=runtime.adobe.io
key=<api key>
;;
"vagrant")
host=192.168.33.16
key=<api key>
;;
"io-onboarding")
host=wsk-edge.corp.adobe.com
key=<api key>
;;
*)
apihost=`wsk -i property get --apihost | rev | cut -f1 | rev`
namespace=`wsk -i namespace list | tail -n1`
echo "Host ${bold}${apihost}${normal}"
echo "Namespace ${bold}${namespace}${normal}"
echo "Change using: owenv {cloudshell|solutions|sensei|smacdona|vagrant|io-onboarding}"
return
esac
if [ -z $key ] ; then
return
fi
wsk $switches property set --apihost $host --auth $key > /dev/null && \
wsk $switches property unset --namespace > /dev/null
# display some information
apihost=`wsk $switches property get --apihost | rev | cut -f1 | rev`
namespace=`wsk $switches namespace list | tail -n1`
echo "Host ${bold}${apihost}${normal}"
echo "Namespace ${bold}${namespace}${normal}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment