use machine auth secret from common config

This commit is contained in:
Willy Kloucek
2022-04-27 14:40:53 +02:00
parent b3f55765d8
commit f74d1e27c1
8 changed files with 21 additions and 8 deletions
@@ -1,6 +1,7 @@
package defaults
import (
"log"
"path/filepath"
"github.com/owncloud/ocis/extensions/sharing/pkg/config"
@@ -114,13 +115,25 @@ func EnsureDefaults(cfg *config.Config) {
cfg.Reva = &config.Reva{}
}
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
cfg.TokenManager = &config.TokenManager{
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
}
} else if cfg.TokenManager == nil {
cfg.TokenManager = &config.TokenManager{}
}
if cfg.UserSharingDrivers.CS3.MachineAuthAPIKey == "" && cfg.Commons != nil && cfg.Commons.MachineAuthAPIKey != "" {
cfg.UserSharingDrivers.CS3.MachineAuthAPIKey = cfg.Commons.MachineAuthAPIKey
} else if cfg.UserSharingDrivers.CS3.MachineAuthAPIKey == "" {
log.Fatalf("machine auth api key for the cs3 user sharing driver is not set up properly, bailing out (%s)", cfg.Service.Name)
}
if cfg.PublicSharingDrivers.CS3.MachineAuthAPIKey == "" && cfg.Commons != nil && cfg.Commons.MachineAuthAPIKey != "" {
cfg.PublicSharingDrivers.CS3.MachineAuthAPIKey = cfg.Commons.MachineAuthAPIKey
} else if cfg.PublicSharingDrivers.CS3.MachineAuthAPIKey == "" {
log.Fatalf("machine auth api key for the cs3 public sharing driver is not set up properly, bailing out (%s)", cfg.Service.Name)
}
}
func Sanitize(cfg *config.Config) {