diff --git a/src/configure-balena-host-envvars.sh b/src/configure-balena-host-envvars.sh index d3b000e4..dfe764ab 100755 --- a/src/configure-balena-host-envvars.sh +++ b/src/configure-balena-host-envvars.sh @@ -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