diff options
author | Frédéric Guillot <fred@miniflux.net> | 2019-06-02 07:13:35 -0700 |
---|---|---|
committer | fguillot <fred@miniflux.net> | 2019-06-02 07:29:56 -0700 |
commit | bb720c87c191efe36a328d95a918f75df51d4976 (patch) | |
tree | 35b6e87ddf5c0b37208f489fd6680075f269a3ef /config/options.go | |
parent | 228862fefaa645026caa483ffe9993bf8c00b22e (diff) |
Make HTTP Client timeout and max body size configurable
Diffstat (limited to 'config/options.go')
-rw-r--r-- | config/options.go | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/config/options.go b/config/options.go index ad8d2c7..32105e9 100644 --- a/config/options.go +++ b/config/options.go @@ -5,25 +5,27 @@ package config // import "miniflux.app/config" const ( - defaultBaseURL = "http://localhost" - defaultWorkerPoolSize = 5 - defaultPollingFrequency = 60 - defaultBatchSize = 10 - defaultDatabaseURL = "user=postgres password=postgres dbname=miniflux2 sslmode=disable" - defaultDatabaseMaxConns = 20 - defaultDatabaseMinConns = 1 - defaultArchiveReadDays = 60 - defaultListenAddr = "127.0.0.1:8080" - defaultCertFile = "" - defaultKeyFile = "" - defaultCertDomain = "" - defaultCertCache = "/tmp/cert_cache" - defaultCleanupFrequency = 24 - defaultProxyImages = "http-only" - defaultOAuth2ClientID = "" - defaultOAuth2ClientSecret = "" - defaultOAuth2RedirectURL = "" - defaultOAuth2Provider = "" + defaultBaseURL = "http://localhost" + defaultWorkerPoolSize = 5 + defaultPollingFrequency = 60 + defaultBatchSize = 10 + defaultDatabaseURL = "user=postgres password=postgres dbname=miniflux2 sslmode=disable" + defaultDatabaseMaxConns = 20 + defaultDatabaseMinConns = 1 + defaultArchiveReadDays = 60 + defaultListenAddr = "127.0.0.1:8080" + defaultCertFile = "" + defaultKeyFile = "" + defaultCertDomain = "" + defaultCertCache = "/tmp/cert_cache" + defaultCleanupFrequency = 24 + defaultProxyImages = "http-only" + defaultOAuth2ClientID = "" + defaultOAuth2ClientSecret = "" + defaultOAuth2RedirectURL = "" + defaultOAuth2Provider = "" + defaultHTTPClientTimeout = 20 + defaultHTTPClientMaxBodySize = 15 ) // Options contains configuration options. @@ -58,6 +60,8 @@ type Options struct { oauth2RedirectURL string oauth2Provider string pocketConsumerKey string + httpClientTimeout int + httpClientMaxBodySize int64 } // HasDebugMode returns true if debug mode is enabled. @@ -212,3 +216,13 @@ func (o *Options) PocketConsumerKey(defaultValue string) string { } return defaultValue } + +// HTTPClientTimeout returns the time limit in seconds before the HTTP client cancel the request. +func (o *Options) HTTPClientTimeout() int { + return o.httpClientTimeout +} + +// HTTPClientMaxBodySize returns the number of bytes allowed for the HTTP client to transfer. +func (o *Options) HTTPClientMaxBodySize() int64 { + return o.httpClientMaxBodySize +} |