summaryrefslogtreecommitdiff
path: root/server_config.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-09-10 14:19:52 +0300
committerWolfy-J <[email protected]>2018-09-10 14:19:52 +0300
commit569a0dec066ea53fd6d0a2080362db67fd794557 (patch)
treed7a1f66bce8fe515e4d0248ab4aa65d05d0bcb8d /server_config.go
parentd8032d0512f59b34ec334cdac7b7ce2d8fe7f6c1 (diff)
changelog
Diffstat (limited to 'server_config.go')
-rw-r--r--server_config.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/server_config.go b/server_config.go
index 88d15e1f..1a24e335 100644
--- a/server_config.go
+++ b/server_config.go
@@ -33,6 +33,21 @@ type ServerConfig struct {
env []string
}
+// SetDefaults sets missing values to their default values.
+func (cfg *ServerConfig) SetDefaults() {
+ if cfg.RelayTimeout == 0 {
+ cfg.RelayTimeout = time.Minute
+ }
+
+ if cfg.Pool.AllocateTimeout == 0 {
+ cfg.Pool.AllocateTimeout = time.Minute
+ }
+
+ if cfg.Pool.DestroyTimeout == 0 {
+ cfg.Pool.DestroyTimeout = time.Minute
+ }
+}
+
// Differs returns true if configuration has changed but ignores pool or cmd changes.
func (cfg *ServerConfig) Differs(new *ServerConfig) bool {
return cfg.Relay != new.Relay || cfg.RelayTimeout != new.RelayTimeout