Skip to content

Commit

Permalink
WIP: hostname-vars: Ensure previous hostname envvars aren't overwritten
Browse files Browse the repository at this point in the history
Connects-to: #78
Change-type: patch
Signed-off-by: Heds Simons <[email protected]>
  • Loading branch information
Heds Simons committed Mar 14, 2019
1 parent a4b121f commit decdaab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/configure-balena-host-envvars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ HOST_ENVVARS[BALENA_SENTRY_URL_HOST]=sentry
HOST_ENVVARS[BALENA_MONITOR_HOST]=monitor

# Go through the lists and fill in any missing envvars
#for index in $(seq 1 ${#HOST_ENVVARS[*]}); do
for VARNAME in "${!HOST_ENVVARS[@]}"; do
VARVALUE="${HOST_ENVVARS[$VARNAME]}"
if [[ ! -z "$VARVALUE" ]]; then
VARVALUE=${!VARNAME}
if [[ -z "$VARVALUE" ]]; then
PREFIX="${HOST_ENVVARS[$VARNAME]}"
# Only use BALENA_DEVICE_UUID if it actually exists, else just use the
# full passed in TLD
DEVICE=""
if [[ ! -z "$BALENA_DEVICE_UUID" ]]; then
DEVICE="$BALENA_DEVICE_UUID."
fi
SUBDOMAIN="$VARVALUE.$DEVICE$BALENA_TLD"
SUBDOMAIN="$PREFIX.$DEVICE$BALENA_TLD"

# Several vars require special formatting
if [ "$VARNAME" == "BALENA_TOKEN_AUTH_REALM" ]; then
Expand Down

0 comments on commit decdaab

Please sign in to comment.