worker: make default config values more idiomatic
The only functional change is that base_path = "" will be now parsed as: config.BasePath == "" which wasn't possible before. Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
parent
dc78b05a19
commit
9af6d1d43b
1 changed files with 5 additions and 4 deletions
|
|
@ -64,7 +64,11 @@ type workerConfig struct {
|
|||
}
|
||||
|
||||
func parseConfig(file string) (*workerConfig, error) {
|
||||
var config workerConfig
|
||||
// set defaults
|
||||
config := workerConfig{
|
||||
BasePath: "/api/worker/v1",
|
||||
}
|
||||
|
||||
_, err := toml.DecodeFile(file, &config)
|
||||
if err != nil {
|
||||
// Return error only when we failed to decode the file.
|
||||
|
|
@ -75,9 +79,6 @@ func parseConfig(file string) (*workerConfig, error) {
|
|||
|
||||
logrus.Info("Configuration file not found, using defaults")
|
||||
}
|
||||
if config.BasePath == "" {
|
||||
config.BasePath = "/api/worker/v1"
|
||||
}
|
||||
|
||||
return &config, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue