forked from stolostron/console-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-env.sh
More file actions
26 lines (22 loc) · 679 Bytes
/
setup-env.sh
File metadata and controls
26 lines (22 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright (c) 2020 Red Hat, Inc.
# Copyright Contributors to the Open Cluster Management project
if ! jq --version > /dev/null 2>&1; then
echo "Missing dependency: jq"
return
elif ! oc version> /dev/null 2>&1; then
echo "Missing dependency: oc"
return
fi
OCM_NAMESPACE=open-cluster-management
OCM_ROUTE=multicloud-console
OCM_ADDRESS=https://`oc -n $OCM_NAMESPACE get route $OCM_ROUTE -o json | jq -r '.spec.host'`
SERVICEACCT_TOKEN=$(oc whoami -t)
API_SERVER_URL=$(oc whoami --show-server)
echo
echo '"env": {'
for variable in SERVICEACCT_TOKEN API_SERVER_URL
do
export $variable
eval printf '" \"%s\": \"%s\",\\n"' "$variable" "\${$variable?}"
done
echo '}'