From c2697725ead29c3c108a8e5f7a9f6ab7519ed7c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sun, 4 Jun 2023 21:55:50 +0200 Subject: Add new config option to set max number of IMAP connections. Default is 5 (as was the hard-coded value before). Closes issue #98. --- pkg/config/config.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pkg') 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 } -- cgit v1.2.3