diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2023-06-04 21:55:50 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2023-06-04 22:06:19 +0200 |
commit | c2697725ead29c3c108a8e5f7a9f6ab7519ed7c3 (patch) | |
tree | c4432926812476c384ae06feb949887d5f896ed8 /pkg/config | |
parent | 565b1a1eef18372aa3e75efa47b34aec47a53571 (diff) | |
download | feed2imap-go-c2697725ead29c3c108a8e5f7a9f6ab7519ed7c3.tar.gz feed2imap-go-c2697725ead29c3c108a8e5f7a9f6ab7519ed7c3.tar.bz2 feed2imap-go-c2697725ead29c3c108a8e5f7a9f6ab7519ed7c3.zip |
Add new config option to set max number of IMAP connections.
Default is 5 (as was the hard-coded value before).
Closes issue #98.
Diffstat (limited to 'pkg/config')
-rw-r--r-- | pkg/config/config.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/config/config.go b/pkg/config/config.go index 0d2c944..aaf6701 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -23,6 +23,7 @@ type GlobalOptions struct { Target Url `yaml:"target"` Parts []string `yaml:"parts"` MaxFailures int `yaml:"max-failures"` + MaxConns int `yaml:"max-imap-connections"` AutoTarget bool `yaml:"auto-target"` HtmlTemplate string `yaml:"html-template"` TextTemplate string `yaml:"text-template"` @@ -32,6 +33,7 @@ var DefaultGlobalOptions = GlobalOptions{ Cache: "feed.cache", Timeout: 30, MaxFailures: 10, + MaxConns: 5, DefaultEmail: username() + "@" + Hostname(), Target: Url{}, Parts: []string{"text", "html"}, @@ -103,6 +105,10 @@ func (cfg *Config) Validate() error { } } + if cfg.MaxConns < 1 { + return fmt.Errorf("max-imap-connections is '%d', but must be at least 1.", cfg.MaxConns) + } + return nil } |