From decdaab3a6d7686e7ec749fdcf1440a0bbe551dd Mon Sep 17 00:00:00 2001 From: Heds Simons Date: Thu, 14 Mar 2019 15:28:57 +0000 Subject: [PATCH] WIP: hostname-vars: Ensure previous hostname envvars aren't overwritten Connects-to: #78 Change-type: patch Signed-off-by: Heds Simons --- src/configure-balena-host-envvars.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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