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

Reorder config loading so it doesn't merge values inappropriately #185

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
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
13 changes: 7 additions & 6 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,6 @@ type Configuration struct {
// This function does not modify the currently stored global configuration.
func NewAtPath(path string) (*Configuration, error) {
var c Configuration
// Configures the default values for many of the configuration options present
// in the structs. Values set in the configuration file take priority over the
// default values.
if err := defaults.Set(&c); err != nil {
return nil, err
}
// Track the location where we created this configuration.
c.path = path
return &c, nil
Expand Down Expand Up @@ -513,6 +507,13 @@ func FromFile(path string) error {
return err
}

// Configures the default values for many of the configuration options present
// in the structs. Values set in the configuration file will not be overridden by the
// default values.
if err := defaults.Set(c); err != nil {
return err
}

// Store this configuration in the global state.
Set(c)
return nil
Expand Down
Loading