Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/aou-common/load-envs/load-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# Usage: source load-env.sh

SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
readonly SCRIPT_DIR

# Get the environment variables inside a function so that the set -o options
Expand All @@ -30,10 +30,16 @@ function get_env_vars() {
return 1
fi

WORKSPACE_ID="$(jq -er '.workspace.userFacingId' "${CONTEXT_PATH}")"
if ! WORKSPACE_ID="$(jq -er '.workspace.userFacingId' "${CONTEXT_PATH}")"; then
echo "Workspace ID is not set in ${CONTEXT_PATH}." >&2
return 1
fi
readonly WORKSPACE_ID

WSM_API_URL="$(jq -er '.server.workspaceManagerUri' "${CONTEXT_PATH}")"
if ! WSM_API_URL="$(jq -er '.server.workspaceManagerUri' "${CONTEXT_PATH}")"; then
echo "WSM API URL is not set in ${CONTEXT_PATH}." >&2
return 1
fi
readonly WSM_API_URL

if wb auth status 2>&1 | grep -q "NO USER LOGGED IN"; then
Expand Down
Loading