Skip to content

Commit

Permalink
fix: default config override (#719)
Browse files Browse the repository at this point in the history
  • Loading branch information
nemanja-m authored Dec 17, 2024
1 parent 2186c12 commit 0232344
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 3 additions & 1 deletion runner/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,9 @@ func (c *Config) rel(path string) string {
// WithArgs returns a new config with the given arguments added to the configuration.
func (c *Config) WithArgs(args map[string]TomlInfo) {
for _, value := range args {
if value.Value != nil && *value.Value != unsetDefault {
// Ignore values that match the default configuration.
// This ensures user-specified configurations are not overwritten by default values.
if value.Value != nil && *value.Value != value.fieldValue {
v := reflect.ValueOf(c)
setValue2Struct(v, value.fieldPath, *value.Value)
}
Expand Down
2 changes: 0 additions & 2 deletions runner/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"flag"
)

const unsetDefault = "DEFAULT"

// ParseConfigFlag parse toml information for flag
func ParseConfigFlag(f *flag.FlagSet) map[string]TomlInfo {
c := defaultConfig()
Expand Down

0 comments on commit 0232344

Please sign in to comment.