From 19d88fc879ba403347726138eb532fb85d38168e Mon Sep 17 00:00:00 2001 From: Wolfy-J Date: Sun, 23 Sep 2018 14:52:55 +0300 Subject: default configs --- server_config.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'server_config.go') diff --git a/server_config.go b/server_config.go index e2f9266b..b2d8845b 100644 --- a/server_config.go +++ b/server_config.go @@ -33,8 +33,8 @@ type ServerConfig struct { env []string } -// SetDefaults sets missing values to their default values. -func (cfg *ServerConfig) SetDefaults() { +// InitDefaults sets missing values to their default values. +func (cfg *ServerConfig) InitDefaults() error { if cfg.Relay == "" { cfg.Relay = "pipes" } @@ -47,13 +47,7 @@ func (cfg *ServerConfig) SetDefaults() { cfg.Pool = &Config{} } - if cfg.Pool.AllocateTimeout == 0 { - cfg.Pool.AllocateTimeout = time.Minute - } - - if cfg.Pool.DestroyTimeout == 0 { - cfg.Pool.DestroyTimeout = time.Minute - } + return cfg.Pool.InitDefaults() } // UpscaleDurations converts duration values from nanoseconds to seconds. -- cgit v1.2.3 From 46c53d51cd8edd4e934c47f49f806758f4ccad63 Mon Sep 17 00:00:00 2001 From: Wolfy-J Date: Sun, 23 Sep 2018 15:00:51 +0300 Subject: default configs --- server_config.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'server_config.go') diff --git a/server_config.go b/server_config.go index b2d8845b..936744a1 100644 --- a/server_config.go +++ b/server_config.go @@ -35,13 +35,8 @@ type ServerConfig struct { // InitDefaults sets missing values to their default values. func (cfg *ServerConfig) InitDefaults() error { - if cfg.Relay == "" { - cfg.Relay = "pipes" - } - - if cfg.RelayTimeout == 0 { - cfg.RelayTimeout = time.Minute - } + cfg.Relay = "pipes" + cfg.RelayTimeout = time.Minute if cfg.Pool == nil { cfg.Pool = &Config{} -- cgit v1.2.3