summaryrefslogtreecommitdiff
path: root/service/http/config.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-09-23 15:00:51 +0300
committerWolfy-J <[email protected]>2018-09-23 15:00:51 +0300
commit46c53d51cd8edd4e934c47f49f806758f4ccad63 (patch)
tree5e04c41ebb1b8eba5713c992c3d4866e8fb959fb /service/http/config.go
parent19d88fc879ba403347726138eb532fb85d38168e (diff)
default configs
Diffstat (limited to 'service/http/config.go')
-rw-r--r--service/http/config.go34
1 files changed, 11 insertions, 23 deletions
diff --git a/service/http/config.go b/service/http/config.go
index 321072c5..26cede37 100644
--- a/service/http/config.go
+++ b/service/http/config.go
@@ -9,9 +9,6 @@ import (
// Config configures RoadRunner HTTP server.
type Config struct {
- // Enable enables http service.
- Enable bool
-
// Address and port to handle as http server.
Address string
@@ -27,41 +24,32 @@ type Config struct {
// Hydrate must populate Config values using given Config source. Must return error if Config is not valid.
func (c *Config) Hydrate(cfg service.Config) error {
- if err := cfg.Unmarshal(c); err != nil {
- return err
+ if c.Workers == nil {
+ c.Workers = &roadrunner.ServerConfig{}
}
- if !c.Enable {
- return nil
+ if c.Uploads == nil {
+ c.Uploads = &UploadsConfig{}
}
- if c.Workers != nil {
- c.Workers.InitDefaults()
- }
+ c.Uploads.InitDefaults()
+ c.Workers.InitDefaults()
- if err := c.Valid(); err != nil {
+ if err := cfg.Unmarshal(c); err != nil {
return err
}
c.Workers.UpscaleDurations()
+ if err := c.Valid(); err != nil {
+ return err
+ }
+
return nil
}
// Valid validates the configuration.
func (c *Config) Valid() error {
- if c.Uploads == nil {
- return errors.New("mailformed uploads config")
- }
-
- if c.Workers == nil {
- return errors.New("mailformed workers config")
- }
-
- if c.Workers.Pool == nil {
- return errors.New("mailformed workers config (pool config is missing)")
- }
-
if err := c.Workers.Pool.Valid(); err != nil {
return err
}