propagate storage common logging config

This commit is contained in:
A.Unger
2021-11-11 13:58:19 +01:00
parent c6191b7404
commit 7eb2c25d65
15 changed files with 24 additions and 50 deletions

View File

@@ -159,13 +159,7 @@ func Start(o ...Option) error {
FailureBackoff: 3 * time.Second,
})
// reva storages have their own logging. For consistency's sake the top level logging will cascade to reva.
s.cfg.Storage.Log.Color = s.cfg.Log.Color
s.cfg.Storage.Log.Level = s.cfg.Log.Level
s.cfg.Storage.Log.Pretty = s.cfg.Log.Pretty
s.cfg.Storage.Log.File = s.cfg.Log.File
if err := rpc.Register(s); err != nil {
if err = rpc.Register(s); err != nil {
if s != nil {
s.Log.Fatal().Err(err)
}

View File

@@ -132,9 +132,7 @@ type AppProviderSutureService struct {
// NewAppProvider creates a new store.AppProviderSutureService
func NewAppProvider(cfg *ociscfg.Config) suture.Service {
if cfg.Mode == 0 {
cfg.Storage.Reva.AppProvider.Supervised = true
}
cfg.Storage.Log = cfg.Commons.Log
return AppProviderSutureService{
cfg: cfg.Storage,
}

View File

@@ -151,9 +151,7 @@ type AuthBasicSutureService struct {
// NewAuthBasicSutureService creates a new store.AuthBasicSutureService
func NewAuthBasic(cfg *ociscfg.Config) suture.Service {
if cfg.Mode == 0 {
cfg.Storage.Reva.AuthBasic.Supervised = true
}
cfg.Storage.Log = cfg.Commons.Log
return AuthBasicSutureService{
cfg: cfg.Storage,
}

View File

@@ -127,9 +127,7 @@ type AuthBearerSutureService struct {
// NewAuthBearerSutureService creates a new gateway.AuthBearerSutureService
func NewAuthBearer(cfg *ociscfg.Config) suture.Service {
if cfg.Mode == 0 {
cfg.Storage.Reva.AuthBearer.Supervised = true
}
cfg.Storage.Log = cfg.Commons.Log
return AuthBearerSutureService{
cfg: cfg.Storage,
}

View File

@@ -123,9 +123,7 @@ type AuthMachineSutureService struct {
// NewAuthMachineSutureService creates a new gateway.AuthMachineSutureService
func NewAuthMachine(cfg *ociscfg.Config) suture.Service {
if cfg.Mode == 0 {
cfg.Storage.Reva.AuthMachine.Supervised = true
}
cfg.Storage.Log = cfg.Commons.Log
return AuthMachineSutureService{
cfg: cfg.Storage,
}

View File

@@ -335,11 +335,9 @@ type FrontendSutureService struct {
cfg *config.Config
}
// NewFrontendSutureService creates a new frontend.FrontendSutureService
// NewFrontend creates a new frontend.FrontendSutureService
func NewFrontend(cfg *ociscfg.Config) suture.Service {
if cfg.Mode == 0 {
cfg.Storage.Reva.Frontend.Supervised = true
}
cfg.Storage.Log = cfg.Commons.Log
return FrontendSutureService{
cfg: cfg.Storage,
}

View File

@@ -351,9 +351,7 @@ type GatewaySutureService struct {
// NewGatewaySutureService creates a new gateway.GatewaySutureService
func NewGateway(cfg *ociscfg.Config) suture.Service {
if cfg.Mode == 0 {
cfg.Storage.Reva.Gateway.Supervised = true
}
cfg.Storage.Log = cfg.Commons.Log
return GatewaySutureService{
cfg: cfg.Storage,
}

View File

@@ -165,9 +165,7 @@ type GroupSutureService struct {
// NewGroupProviderSutureService creates a new storage.GroupProvider
func NewGroupProvider(cfg *ociscfg.Config) suture.Service {
if cfg.Mode == 0 {
cfg.Storage.Reva.Groups.Supervised = true
}
cfg.Storage.Log = cfg.Commons.Log
return GroupSutureService{
cfg: cfg.Storage,
}

View File

@@ -191,9 +191,7 @@ type SharingSutureService struct {
// NewSharingSutureService creates a new store.SharingSutureService
func NewSharing(cfg *ociscfg.Config) suture.Service {
if cfg.Mode == 0 {
cfg.Storage.Reva.Sharing.Supervised = true
}
cfg.Storage.Log = cfg.Commons.Log
return SharingSutureService{
cfg: cfg.Storage,
}

View File

@@ -150,9 +150,7 @@ type StorageHomeSutureService struct {
// NewStorageHomeSutureService creates a new storage.StorageHomeSutureService
func NewStorageHome(cfg *ociscfg.Config) suture.Service {
if cfg.Mode == 0 {
cfg.Storage.Reva.StorageHome.Supervised = true
}
cfg.Storage.Log = cfg.Commons.Log
return StorageHomeSutureService{
cfg: cfg.Storage,
}

View File

@@ -166,9 +166,7 @@ type MetadataSutureService struct {
// NewSutureService creates a new storagemetadata.SutureService
func NewStorageMetadata(cfg *ociscfg.Config) suture.Service {
if cfg.Mode == 0 {
cfg.Storage.Reva.StorageMetadata.Supervised = true
}
cfg.Storage.Log = cfg.Commons.Log
return MetadataSutureService{
cfg: cfg.Storage,
}

View File

@@ -124,9 +124,7 @@ type StoragePublicLinkSutureService struct {
// NewStoragePublicLinkSutureService creates a new storage.StoragePublicLinkSutureService
func NewStoragePublicLink(cfg *ociscfg.Config) suture.Service {
if cfg.Mode == 0 {
cfg.Storage.Reva.StoragePublicLink.Supervised = true
}
cfg.Storage.Log = cfg.Commons.Log
return StoragePublicLinkSutureService{
cfg: cfg.Storage,
}

View File

@@ -150,9 +150,7 @@ type StorageUsersSutureService struct {
// NewStorageUsersSutureService creates a new storage.StorageUsersSutureService
func NewStorageUsers(cfg *ociscfg.Config) suture.Service {
if cfg.Mode == 0 {
cfg.Storage.Reva.StorageUsers.Supervised = true
}
cfg.Storage.Log = cfg.Commons.Log
return StorageUsersSutureService{
cfg: cfg.Storage,
}

View File

@@ -186,9 +186,7 @@ type UserProviderSutureService struct {
// NewUserProviderSutureService creates a new storage.UserProvider
func NewUserProvider(cfg *ociscfg.Config) suture.Service {
if cfg.Mode == 0 {
cfg.Storage.Reva.Users.Supervised = true
}
cfg.Storage.Log = cfg.Commons.Log
return UserProviderSutureService{
cfg: cfg.Storage,
}

View File

@@ -1,6 +1,10 @@
package config
import "context"
import (
"context"
"github.com/owncloud/ocis/ocis-pkg/shared"
)
// Log defines the available logging configuration.
type Log struct {
@@ -497,7 +501,7 @@ type Asset struct {
// Config combines all available configuration parts.
type Config struct {
File string
Log Log
Log *shared.Log
Debug Debug
Reva Reva
Tracing Tracing
@@ -506,5 +510,7 @@ type Config struct {
// New initializes a new configuration with or without defaults.
func New() *Config {
return &Config{}
return &Config{
Log: &shared.Log{},
}
}