Skip to content

Commit 7bb7696

Browse files
committed
Revert "chore: reorder config loading to load config, *then* fill in missing defaults (#185)"
This reverts commit 708cdd0.
1 parent 695b2ea commit 7bb7696

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

config/config.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,12 @@ type Configuration struct {
359359
// This function does not modify the currently stored global configuration.
360360
func NewAtPath(path string) (*Configuration, error) {
361361
var c Configuration
362+
// Configures the default values for many of the configuration options present
363+
// in the structs. Values set in the configuration file take priority over the
364+
// default values.
365+
if err := defaults.Set(&c); err != nil {
366+
return nil, err
367+
}
362368
// Track the location where we created this configuration.
363369
c.path = path
364370
return &c, nil
@@ -570,13 +576,6 @@ func FromFile(path string) error {
570576
return err
571577
}
572578

573-
// Configures the default values for many of the configuration options present
574-
// in the structs. Values set in the configuration file will not be overridden by the
575-
// default values.
576-
if err := defaults.Set(c); err != nil {
577-
return err
578-
}
579-
580579
c.Token = Token{
581580
ID: os.Getenv("WINGS_TOKEN_ID"),
582581
Token: os.Getenv("WINGS_TOKEN"),

0 commit comments

Comments
 (0)