aboutsummaryrefslogtreecommitdiff
path: root/pkg/config/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/config/config.go')
-rw-r--r--pkg/config/config.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/pkg/config/config.go b/pkg/config/config.go
index 83c952f..1b95f61 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -39,6 +39,15 @@ type Options struct {
InclImages *bool `yaml:"include-images"`
}
+func (opt *Options) mergeFrom(other Options) {
+ if opt.MinFreq == nil {
+ opt.MinFreq = other.MinFreq
+ }
+ if opt.InclImages == nil {
+ opt.InclImages = other.InclImages
+ }
+}
+
// Default feed options
var DefaultFeedOptions Options
@@ -111,9 +120,17 @@ func Load(path string) (*Config, error) {
return nil, fmt.Errorf("while parsing: %w", err)
}
+ cfg.pushFeedOptions()
+
return cfg, nil
}
+func (cfg *Config) pushFeedOptions() {
+ for _, feed := range cfg.Feeds {
+ feed.Options.mergeFrom(cfg.FeedOptions)
+ }
+}
+
func hostname() (hostname string) {
hostname, err := os.Hostname()
if err != nil {