From d726ba4615fb5b876d0c93a14fe22ddec7f84f2a Mon Sep 17 00:00:00 2001 From: Denis Gukov Date: Fri, 15 Sep 2023 01:12:53 +0200 Subject: [PATCH] fix(config): load defaults before load file --- deployment/docker/common/runner-wrapper | 4 ++-- util/config.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deployment/docker/common/runner-wrapper b/deployment/docker/common/runner-wrapper index d000669f..a20faae6 100755 --- a/deployment/docker/common/runner-wrapper +++ b/deployment/docker/common/runner-wrapper @@ -10,7 +10,7 @@ SEMAPHORE_RUNNER_CONFIG_FILE="${SEMAPHORE_RUNNER_CONFIG_FILE:-/var/lib/semaphore SEMAPHORE_TMP_PATH="${SEMAPHORE_TMP_PATH:-/tmp/semaphore}" SEMAPHORE_REGISTRATION_TOKEN="${SEMAPHORE_REGISTRATION_TOKEN:-}" -SEMAPHORE_API_URL="${SEMAPHORE_API_URL:-}" +SEMAPHORE_RUNNER_API_URL="${SEMAPHORE_RUNNER_API_URL:-}" SEMAPHORE_RUNNER_ONE_OFF="${SEMAPHORE_RUNNER_ONE_OFF:-false}" # Create a config if it does not exist in the current config path @@ -23,7 +23,7 @@ if [ ! -f "${SEMAPHORE_CONFIG_PATH}/config.json" ]; then "runner": { "registration_token": "${SEMAPHORE_REGISTRATION_TOKEN}", "config_file": "${SEMAPHORE_RUNNER_CONFIG_FILE}", - "api_url": "${SEMAPHORE_API_URL}", + "api_url": "${SEMAPHORE_RUNNER_API_URL}", "one_off": ${SEMAPHORE_RUNNER_ONE_OFF} } } diff --git a/util/config.go b/util/config.go index 82737f3e..7b569f98 100644 --- a/util/config.go +++ b/util/config.go @@ -189,9 +189,9 @@ func (conf *ConfigType) ToJSON() ([]byte, error) { // ConfigInit reads in cli flags, and switches actions appropriately on them func ConfigInit(configPath string) { fmt.Println("Loading config") + loadConfigDefaults() loadConfigFile(configPath) loadConfigEnvironment() - loadConfigDefaults() fmt.Println("Validating config") validateConfig()