From c0ac92af445454e3850827a504baab9f82fa6cd3 Mon Sep 17 00:00:00 2001 From: Maximilian Weiler <16721506+maweil@users.noreply.github.com> Date: Thu, 29 Dec 2022 22:17:15 +0100 Subject: [PATCH] fix: Address code review comments - Split comment in config file into two lines - De-duplicate incovation for setting superuser password --- entrypoint.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index fc8c417..b264220 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -74,7 +74,8 @@ if [[ -f "$MUMBLE_CUSTOM_CONFIG_FILE" ]]; then CONFIG_FILE="$MUMBLE_CUSTOM_CONFIG_FILE" else # Ensures the config file is empty, starting from a clean slate - echo -e "# Config file automatically generated from the MUMBLE_CONFIG_* environment variables or secrets in /run/secrets/MUMBLE_CONFIG_* files\n" > "${CONFIG_FILE}" + echo -e "# Config file automatically generated from the MUMBLE_CONFIG_* environment variables" > "${CONFIG_FILE}" + echo -e "# or secrets in /run/secrets/MUMBLE_CONFIG_* files\n" >> "${CONFIG_FILE}" # Process settings through variables of format MUMBLE_CONFIG_* @@ -111,7 +112,7 @@ else else set_config "$config_option" "$(cat $secret_file)" fi - done < <(ls /run/secrets | sed -n 's/^MUMBLE_CONFIG_//p') + done < <( ls /run/secrets | sed -n 's/^MUMBLE_CONFIG_//p' ) # Apply default settings if they're missing @@ -147,10 +148,11 @@ fi server_invocation+=( "-ini" "${CONFIG_FILE}") if [[ -f /run/secrets/MUMBLE_SUPERUSER_PASSWORD ]]; then - #Variable to change the superuser password - "${server_invocation[@]}" -supw "$(cat /run/secrets/MUMBLE_SUPERUSER_PASSWORD)" - echo "Successfully configured superuser password from container secret" -elif [[ -n "${MUMBLE_SUPERUSER_PASSWORD}" ]]; then + MUMBLE_SUPERUSER_PASSWORD="$(cat /run/secrets/MUMBLE_SUPERUSER_PASSWORD)" + echo "Read superuser password from container secret" +fi + +if [[ -n "${MUMBLE_SUPERUSER_PASSWORD}" ]]; then #Variable to change the superuser password "${server_invocation[@]}" -supw "$MUMBLE_SUPERUSER_PASSWORD" echo "Successfully configured superuser password"