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

View File

@@ -117,7 +117,7 @@ func EnsureDefaults(cfg *config.Config) {
if cfg.TransferSecret == "" && cfg.Commons != nil && cfg.Commons.TransferSecret != "" {
cfg.TransferSecret = cfg.Commons.TransferSecret
} else {
} else if cfg.TransferSecret == "" {
log.Fatalf("reva transfer secret is not set up properly, bailing out (%s)", cfg.Service.Name)
}
}

View File

@@ -105,7 +105,7 @@ func EnsureDefaults(cfg *config.Config) {
if cfg.TransferSecret == "" && cfg.Commons != nil && cfg.Commons.TransferSecret != "" {
cfg.TransferSecret = cfg.Commons.TransferSecret
} else {
} else if cfg.TransferSecret == "" {
log.Fatalf("reva transfer secret is not set up properly, bailing out (%s)", cfg.Service.Name)
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -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) {

View File

@@ -76,7 +76,7 @@ func EnsureDefaults(cfg *config.Config) {
if cfg.Thumbnail.TransferSecret == "" && cfg.Commons != nil && cfg.Commons.TransferSecret != "" {
cfg.Thumbnail.TransferSecret = cfg.Commons.TransferSecret
} else {
} else if cfg.TransferSecret == "" {
log.Fatalf("reva transfer secret is not set up properly, bailing out (%s)", cfg.Service.Name)
}
}