Skip to content

Commit

Permalink
Fix: global_conf not taking priority
Browse files Browse the repository at this point in the history
  • Loading branch information
kiliantyler committed Feb 29, 2024
1 parent 449dacb commit 74a8ce8
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions cmd/yamlfmt/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,19 @@ func getConfigPath() (string, error) {

func getConfigPathFromFlag() (string, error) {
// If there is a path specified in the conf flag, that takes precedence
configPath := *flagConf
if configPath == "" {
logger.Debug(logger.DebugCodeConfig, "No config path specified in -conf")
return configPath, errNoConfFlag
}
// Then we check if we want the global config
if *flagGlobalConf {
logger.Debug(logger.DebugCodeConfig, "Using -global_conf flag")
return getConfigPathFromXdgConfigHome()
}
logger.Debug(logger.DebugCodeConfig, "Using config path %s from -conf flag", configPath)
return configPath, validatePath(configPath)

configPath := *flagConf
if configPath != "" {
logger.Debug(logger.DebugCodeConfig, "Using config path %s from -conf flag", configPath)
return configPath, validatePath(configPath)
}
// Then we check if we want the global config
logger.Debug(logger.DebugCodeConfig, "No config path specified in -conf")
return configPath, errNoConfFlag
}

// This function searches up the directory tree until it finds
Expand Down

0 comments on commit 74a8ce8

Please sign in to comment.