summaryrefslogtreecommitdiff
path: root/server_config.go
diff options
context:
space:
mode:
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