CORD-536 updated to support the setting of repo via vars
Change-Id: I84988b634967d8be2e5a9f3a79352be5efa9c0c0
diff --git a/provisioner/provisioner.go b/provisioner/provisioner.go
index 590470b..73d0d1a 100644
--- a/provisioner/provisioner.go
+++ b/provisioner/provisioner.go
@@ -24,10 +24,11 @@
type Config struct {
Port int `default:"4243"`
Listen string `default:"0.0.0.0"`
- RoleSelectorURL string `default:"" envconfig:"role_selector_url"`
- DefaultRole string `default:"compute-node" envconfig:"default_role"`
+ RoleSelectorURL string `default:"" envconfig:"ROLE_SELECTOR_URL"`
+ DefaultRole string `default:"compute-node" envconfig:"DEFAULT_ROLE"`
Script string `default:"do-ansible"`
- StorageURL string `default:"memory:" envconfig:"storage_url"`
+ StorageURL string `default:"memory:" envconfig:"STORAGE_URL"`
+ NumberOfWorkers int `default:"5" envconfig:"NUMBER_OF_WORKERS"`
LogLevel string `default:"warning" envconfig:"LOG_LEVEL"`
LogFormat string `default:"text" envconfig:"LOG_FORMAT"`
}
@@ -66,16 +67,18 @@
log.Level = level
log.Infof(`Configuration:
- Listen: %s
- Port: %d
- RoleSelectorURL: %s
- DefaultRole: %s
- Script: %s
- StorageURL: %s
- Log Level: %s
- Log Format: %s`,
+ LISTEN: %s
+ PORT: %d
+ ROLE_SELECTION_URL: %s
+ DEFAULT_ROLE: %s
+ SCRIPT: %s
+ STORAGE_URL: %s
+ NUMBER_OF_WORERS: %d
+ LOG_LEVEL: %s
+ LOG_FORMAT: %s`,
context.config.Listen, context.config.Port, context.config.RoleSelectorURL,
context.config.DefaultRole, context.config.Script, context.config.StorageURL,
+ context.config.NumberOfWorkers,
context.config.LogLevel, context.config.LogFormat)
context.storage, err = NewStorage(context.config.StorageURL)
@@ -92,7 +95,7 @@
http.Handle("/", router)
// Start the dispatcher and workers
- context.dispatcher = NewDispatcher(5, context.storage)
+ context.dispatcher = NewDispatcher(context.config.NumberOfWorkers, context.storage)
context.dispatcher.Start()
http.ListenAndServe(fmt.Sprintf("%s:%d", context.config.Listen, context.config.Port), nil)