Skip to content

Commit

Permalink
Merge pull request #12 from numus-digital/feature/dynconf2
Browse files Browse the repository at this point in the history
keep creation can now optionally augment Config{}
  • Loading branch information
lrascao committed Sep 1, 2021
2 parents 09f15a8 + 1c84ef2 commit 679e576
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions keep.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ type Keep struct {
}

func NewKeep(settings engine.Settings) (*Keep, error) {
return NewKeepWithConfig(settings, nil)
}

func NewKeepWithConfig(settings engine.Settings, augment func(*config.Config) error) (*Keep, error) {
settings.ConfigFile = ConfigFile(settings.ConfigFile)

var conf config.Config
Expand All @@ -49,6 +53,13 @@ func NewKeep(settings engine.Settings) (*Keep, error) {
return keep, err
}

if augment != nil {
err := augment(&keep.Config)
if err != nil {
return nil, err
}
}

if err := keep.setupExchanges(GCTLog{nil}); err != nil {
return keep, err
}
Expand Down

0 comments on commit 679e576

Please sign in to comment.