diff options
author | Wolfy-J <[email protected]> | 2018-09-23 14:52:55 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-09-23 14:52:55 +0300 |
commit | 19d88fc879ba403347726138eb532fb85d38168e (patch) | |
tree | c93c9ddd7a6fe7be3b884458b3ad8e9f4c9b19ec /config.go | |
parent | bd046974b969af381b3a50513d9f3ab453ed8bbf (diff) |
default configs
Diffstat (limited to 'config.go')
-rw-r--r-- | config.go | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -25,6 +25,19 @@ type Config struct { DestroyTimeout time.Duration } +// InitDefaults allows to init blank config with pre-defined set of default values. +func (cfg *Config) InitDefaults() error { + if cfg.AllocateTimeout == 0 { + cfg.AllocateTimeout = time.Minute + } + + if cfg.DestroyTimeout == 0 { + cfg.DestroyTimeout = time.Minute + } + + return nil +} + // Valid returns error if config not valid. func (cfg *Config) Valid() error { if cfg.NumWorkers == 0 { |