Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(config): allow to set the configuration path from WTF_CONFIG #1572

Merged
merged 1 commit into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,18 @@ func (flags *Flags) Parse() {
return
}

// If no config file is explicitly passed in as a param then set the flag to the default config file
// If no config file is explicitly passed in as a param
// then try the `WTF_CONFIG` environment variable
// then fallback to the default config file to define the default flag value
configDir, err := cfg.WtfConfigDir()
if err != nil {
fmt.Printf("Error: %v\n", err)
os.Exit(1)
}
flags.Config = filepath.Join(configDir, "config.yml")
envCfg := os.Getenv("WTF_CONFIG")
if envCfg == "" {
flags.Config = filepath.Join(configDir, "config.yml")
} else {
flags.Config = envCfg
}
noirbizarre marked this conversation as resolved.
Show resolved Hide resolved
}
Loading