summaryrefslogtreecommitdiff
path: root/service/http/config.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-05-02 16:34:03 +0300
committerWolfy-J <[email protected]>2019-05-02 16:34:03 +0300
commitff7693a6e1dbf5bb63c00eb66a3201e2cd955d20 (patch)
tree238b4a3f638b85180804458f97160455fcca1aff /service/http/config.go
parent677004f7cb97981f0220e2c65a2e7618505d01dc (diff)
parent64f2c19b0a9a33d97bd947e805d0491e68784423 (diff)
Merge branch 'pr/issue-121-rename_maxrequest_config_param' into feature/updates
Diffstat (limited to 'service/http/config.go')
-rw-r--r--service/http/config.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/service/http/config.go b/service/http/config.go
index 5a2c8768..7549cb6c 100644
--- a/service/http/config.go
+++ b/service/http/config.go
@@ -18,8 +18,12 @@ type Config struct {
SSL SSLConfig
// MaxRequest specified max size for payload body in megabytes, set 0 to unlimited.
+ // Deprecated: use `maxRequestSize` instead
MaxRequest int64
+ // MaxRequestSize specified max size for payload body in megabytes, set 0 to unlimited.
+ MaxRequestSize int64
+
// Uploads configures uploads configuration.
Uploads *UploadsConfig
@@ -68,6 +72,7 @@ func (c *Config) Hydrate(cfg service.Config) error {
return err
}
+ c.mergeBackwardCompatibility()
c.Workers.UpscaleDurations()
return c.Valid()
@@ -115,3 +120,10 @@ func (c *Config) Valid() error {
return nil
}
+
+// Perform merge operations for deprecated params to provide backward compatibility
+func (c *Config) mergeBackwardCompatibility() {
+ if c.MaxRequestSize == 0 && c.MaxRequest != 0 {
+ c.MaxRequestSize = c.MaxRequest
+ }
+}