diff --git a/docker/headscale/start.sh b/docker/headscale/start.sh index 40e1225..57d2b79 100644 --- a/docker/headscale/start.sh +++ b/docker/headscale/start.sh @@ -1,8 +1,7 @@ #!/bin/bash -set +e replace_config_values() { - local config_template="/etc/headscale-example/config-example.yaml" + local config_template="/etc/headscale/config-example.yaml" local config_output="/etc/headscale/config.yaml" # Default values @@ -38,11 +37,11 @@ replace_config_values() { if [ -z "$var_value" ]; then var_value=$default_value fi - echo ${line/\$\{$var_name\}/$var_value} + echo "${line/\$\{$var_name\}/$var_value}" } # Read the template and replace variables with defaults if not set - while IFS= read -r line || [[ -n "$line" ]]; do + while IFS='' read -r line || [[ -n "$line" ]]; do line=$(replace_or_default "SERVER_URL" "$DEFAULT_SERVER_URL" "$line") line=$(replace_or_default "LISTEN_ADDR" "$DEFAULT_LISTEN_ADDR" "$line") line=$(replace_or_default "METRICS_LISTEN_ADDR" "$DEFAULT_METRICS_LISTEN_ADDR" "$line") @@ -56,7 +55,6 @@ replace_config_values() { done < "$config_template" > "$config_output" echo "Config file generated at $config_output" - cat $config_output } # Run the function to replace variables and start headscale