Move machine-auth-api-key to shared.Commons

Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
Christian Richter
2022-04-26 10:18:12 +02:00
parent acf75afebc
commit a4d7696232
13 changed files with 67 additions and 43 deletions
@@ -1,6 +1,7 @@
package defaults
import (
"log"
"path"
"strings"
@@ -45,7 +46,6 @@ func DefaultConfig() *config.Config {
AccountBackend: "accounts",
UserOIDCClaim: "email",
UserCS3Claim: "mail",
MachineAuthAPIKey: "change-me-please",
AutoprovisionAccounts: false,
EnableBasicAuth: false,
InsecureBackends: false,
@@ -185,6 +185,12 @@ func EnsureDefaults(cfg *config.Config) {
} else {
cfg.TokenManager = &config.TokenManager{}
}
if cfg.MachineAuthAPIKey == "" && cfg.Commons != nil && cfg.Commons.MachineAuthAPIKey != "" {
cfg.MachineAuthAPIKey = cfg.Commons.MachineAuthAPIKey
} else {
log.Fatalf("machine auth api key is not set up properly, bailing out (%s)", cfg.Service.Name)
}
}
func Sanitize(cfg *config.Config) {