Skip to content

Commit

Permalink
Merge pull request #79 from balena-io/78-fix-hostname-setting
Browse files Browse the repository at this point in the history
hostname-vars: Ensure previous hostname envvars aren't overwritten
  • Loading branch information
hedss authored Mar 14, 2019
2 parents fa3426b + 8eb1904 commit 15a34a9
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 15a34a9

Please sign in to comment.