Skip to content

Commit

Permalink
fix(config): load defaults before load file
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftin committed Sep 14, 2023
1 parent 9af6aa5 commit d726ba4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions deployment/docker/common/runner-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}
}
}
Expand Down
2 changes: 1 addition & 1 deletion util/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit d726ba4

Please sign in to comment.