diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-20 01:01:13 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-20 01:01:13 +0200 |
commit | 161dd4405474cc905e6912bab243509a3a6f88db (patch) | |
tree | 6648d425f4ab64325cb6419e619a88d9af61e5ec /internal/yaml/yaml.go | |
parent | 431a8ddb0c18b0781cba1d01eda3645b361f1b94 (diff) | |
download | feed2imap-go-161dd4405474cc905e6912bab243509a3a6f88db.tar.gz feed2imap-go-161dd4405474cc905e6912bab243509a3a6f88db.tar.bz2 feed2imap-go-161dd4405474cc905e6912bab243509a3a6f88db.zip |
GlobalOptions
Diffstat (limited to 'internal/yaml/yaml.go')
-rw-r--r-- | internal/yaml/yaml.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/internal/yaml/yaml.go b/internal/yaml/yaml.go index 8cbace7..3317f5d 100644 --- a/internal/yaml/yaml.go +++ b/internal/yaml/yaml.go @@ -11,8 +11,9 @@ import ( ) type config struct { - GlobalConfig C.Map `yaml:",inline"` - Feeds []configGroupFeed + C.GlobalOptions `yaml:",inline"` + GlobalConfig C.Map `yaml:",inline"` + Feeds []configGroupFeed } type group struct { @@ -52,9 +53,10 @@ func (grpFeed *configGroupFeed) target() string { } func parse(buf []byte) (config, error) { - var parsedCfg config + parsedCfg := config{GlobalOptions: C.DefaultGlobalOptions} + if err := yaml.Unmarshal(buf, &parsedCfg); err != nil { - return parsedCfg, fmt.Errorf("while unmarshalling: %w", err) + return config{}, fmt.Errorf("while unmarshalling: %w", err) } //fmt.Printf("--- parsedCfg:\n%+v\n\n", parsedCfg) |