Skip to content

Commit

Permalink
add Config.UnmarshalJSON
Browse files Browse the repository at this point in the history
to set defaults and validate same as UnmarshalYAML

PDOK-15461
  • Loading branch information
roelarents committed Mar 21, 2024
1 parent 1ed5167 commit 0a23f57
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error {
return nil
}

func (c *Config) UnmarshalJSON(b []byte) error {
return yaml.Unmarshal(b, c)
}

func setDefaults(config *Config) error {
// process 'default' tags
if err := defaults.Set(config); err != nil {
Expand Down

0 comments on commit 0a23f57

Please sign in to comment.