diff options
Diffstat (limited to 'internal/config/yaml.go')
-rw-r--r-- | internal/config/yaml.go | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/internal/config/yaml.go b/internal/config/yaml.go index 8c40107..80fb383 100644 --- a/internal/config/yaml.go +++ b/internal/config/yaml.go @@ -27,7 +27,7 @@ func (grpFeed *configGroupFeed) isGroup() bool { } func (grpFeed *configGroupFeed) isFeed() bool { - return grpFeed.Feed != Feed{} + return grpFeed.Feed.Name != "" || grpFeed.Feed.Url != "" } func (grpFeed *configGroupFeed) target() string { @@ -51,20 +51,21 @@ func parse(buf []byte) (config, error) { return parsedCfg, nil } -func appTarget(target, app string) string { - if target == "" { - return app - } - - if app == "" { +func appTarget(target []string, app string) []string { + switch { + case len(target) == 0 && app == "": + return []string{} + case len(target) == 0: + return []string{app} + case app == "": return target + default: + return append(target, app) } - - return target + "." + app } // Parse the group structure and populate the `Target` fields in the feeds -func buildFeeds(cfg []configGroupFeed, target string, feeds Feeds) error { +func buildFeeds(cfg []configGroupFeed, target []string, feeds Feeds) error { for idx := range cfg { f := &cfg[idx] // cannot use `_, f := range cfg` as it returns copies(!), but we need the originals target := appTarget(target, f.target()) |