summaryrefslogtreecommitdiff
path: root/config.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-09-23 14:52:55 +0300
committerWolfy-J <[email protected]>2018-09-23 14:52:55 +0300
commit19d88fc879ba403347726138eb532fb85d38168e (patch)
treec93c9ddd7a6fe7be3b884458b3ad8e9f4c9b19ec /config.go
parentbd046974b969af381b3a50513d9f3ab453ed8bbf (diff)
default configs
Diffstat (limited to 'config.go')
-rw-r--r--config.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/config.go b/config.go
index 929ca806..82f05ca3 100644
--- a/config.go
+++ b/config.go
@@ -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 {