aboutsummaryrefslogtreecommitdiff
path: root/pkg/config/config.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pkg/config/config.go64
1 files changed, 14 insertions, 50 deletions
diff --git a/pkg/config/config.go b/pkg/config/config.go
index 885b80e..de8e4ad 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -34,56 +34,29 @@ var DefaultGlobalOptions = GlobalOptions{
}
// Per feed options
+// NB: Always specify a yaml name, as it is later used in processing
type Options struct {
- MinFreq *int `yaml:"min-frequency"`
- InclImages *bool `yaml:"include-images"`
- Disable *bool `yaml:"disable"`
- IgnHash *bool `yaml:"ignore-hash"`
- AlwaysNew *bool `yaml:"always-new"`
- NoTLS *bool `yaml:"tls-no-verify"`
-}
-
-func (opt *Options) mergeFrom(other Options) {
- if opt.MinFreq == nil {
- opt.MinFreq = other.MinFreq
- }
- if opt.InclImages == nil {
- opt.InclImages = other.InclImages
- }
- if opt.IgnHash == nil {
- opt.IgnHash = other.IgnHash
- }
- if opt.AlwaysNew == nil {
- opt.AlwaysNew = other.AlwaysNew
- }
- if opt.Disable == nil {
- opt.Disable = other.Disable
- }
- if opt.NoTLS == nil {
- opt.NoTLS = other.NoTLS
- }
+ MinFreq int `yaml:"min-frequency"`
+ InclImages bool `yaml:"include-images"`
+ Disable bool `yaml:"disable"`
+ IgnHash bool `yaml:"ignore-hash"`
+ AlwaysNew bool `yaml:"always-new"`
+ NoTLS bool `yaml:"tls-no-verify"`
}
// Default feed options
-var DefaultFeedOptions Options
-
-func init() {
- one := 1
- fal := false
- DefaultFeedOptions = Options{
- MinFreq: &one,
- InclImages: &fal,
- IgnHash: &fal,
- AlwaysNew: &fal,
- Disable: &fal,
- NoTLS: &fal,
- }
+var DefaultFeedOptions = Options{
+ MinFreq: 1,
+ InclImages: false,
+ IgnHash: false,
+ AlwaysNew: false,
+ Disable: false,
+ NoTLS: false,
}
// Config holds the global configuration options and the configured feeds
type Config struct {
GlobalOptions `yaml:",inline"`
- GlobalConfig Map `yaml:",inline"`
FeedOptions Options `yaml:"options"`
Feeds Feeds `yaml:"-"`
}
@@ -93,7 +66,6 @@ func WithDefault() *Config {
return &Config{
GlobalOptions: DefaultGlobalOptions,
FeedOptions: DefaultFeedOptions,
- GlobalConfig: Map{},
Feeds: Feeds{},
}
}
@@ -140,17 +112,9 @@ 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 {
e preferences.René 'Necoro' Neumann2-6/+6 Now they are displayed from best to worst. 2010-04-15Add notify-python dependency for the version checkerRené 'Necoro' Neumann1-1/+1 2010-04-15Make the database type choice an info messageRené 'Necoro' Neumann2-7/+13 2010-04-15Renamed es_ES to esRené 'Necoro' Neumann1-0/+0 2010-04-15Fixed dependancy of the new_version plugin from "dev-util/git" to ↵Clement Bourgeois1-1/+1 "dev-vcs/git" to follow new Gentoo portage tree modifications 2010-04-14Make some useless info messages being debug statementsRené 'Necoro' Neumann2-34/+17 2010-04-14Improve the C modulesRené 'Necoro' Neumann3-37/+52 2010-04-14Small modifications made to the French translation (typos, grammar).Clement Bourgeois1-69/+69 2010-04-14Fixed the unicode support and stuff ... and also made eix faster :)René 'Necoro' Neumann1-20/+22 2010-04-14Disable debug messages by defaultRené 'Necoro' Neumann1-1/+1 2010-04-13Better eix error inheritance and handlingRené 'Necoro' Neumann1-2/+9 2010-04-13Fix the handling of FilterSets. Fixes bug #558887.René 'Necoro' Neumann2-56/+64 Now FilterSets are a subclass of InstalledSet. And return only these packages, which are installed ... but then all of them. 2010-04-12Updated newsRené 'Necoro' Neumann1-0/+1 2010-04-13Added my name to translators list.Clement Bourgeois1-0/+1