fix machineauth to right machine auth api key

This commit is contained in:
Willy Kloucek
2022-04-28 08:49:44 +02:00
parent 31656e1a97
commit 4a9b31f3b4

View File

@@ -76,9 +76,9 @@ func EnsureDefaults(cfg *config.Config) {
cfg.TokenManager = &config.TokenManager{}
}
if cfg.MachineAuthAPIKey == "" && cfg.Commons != nil && cfg.Commons.MachineAuthAPIKey != "" {
cfg.MachineAuthAPIKey = cfg.Commons.MachineAuthAPIKey
} else if cfg.MachineAuthAPIKey == "" {
if cfg.AuthProviders.Machine.APIKey == "" && cfg.Commons != nil && cfg.Commons.MachineAuthAPIKey != "" {
cfg.AuthProviders.Machine.APIKey = cfg.Commons.MachineAuthAPIKey
} else if cfg.AuthProviders.Machine.APIKey == "" {
log.Fatalf("machine auth api key is not set up properly, bailing out (%s)", cfg.Service.Name)
}
}