mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-31 09:20:15 -06:00
revert storage, remove tracing.service and bring back common
This commit is contained in:
@@ -67,16 +67,16 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
}
|
||||
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
//if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
// cfg.Log = &shared.Log{
|
||||
// Level: cfg.Commons.Log.Level,
|
||||
// Pretty: cfg.Commons.Log.Pretty,
|
||||
// Color: cfg.Commons.Log.Color,
|
||||
// File: cfg.Commons.Log.File,
|
||||
// }
|
||||
//} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
// cfg.Log = &shared.Log{}
|
||||
//}
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Log = &config.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
Pretty: cfg.Commons.Log.Pretty,
|
||||
Color: cfg.Commons.Log.Color,
|
||||
File: cfg.Commons.Log.File,
|
||||
}
|
||||
} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
cfg.Log = &config.Log{}
|
||||
}
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
envCfg := config.Config{}
|
||||
@@ -99,7 +99,7 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new accounts.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.Accounts.Commons = cfg.Commons
|
||||
cfg.Accounts.Commons = cfg.Commons
|
||||
return SutureService{
|
||||
cfg: cfg.Accounts,
|
||||
}
|
||||
|
||||
@@ -2,14 +2,18 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Service Service
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Log *Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
|
||||
HTTP: HTTP{
|
||||
Addr: "127.0.0.1:9181",
|
||||
Namespace: "com.owncloud.web",
|
||||
@@ -60,9 +59,5 @@ func DefaultConfig() *Config {
|
||||
UID: 0,
|
||||
GID: 0,
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Type: "jaeger",
|
||||
Service: "accounts",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,5 +6,4 @@ type Tracing struct {
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;ACCOUNTS_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;ACCOUNTS_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;ACCOUNTS_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"ACCOUNTS_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
// LoggerFromConfig initializes a service-specific logger instance.
|
||||
func Configure(name string, cfg config.Log) log.Logger {
|
||||
func Configure(name string, cfg *config.Log) log.Logger {
|
||||
return log.NewLogger(
|
||||
log.Name(name),
|
||||
log.Level(cfg.Level),
|
||||
|
||||
@@ -109,9 +109,9 @@ func (s Service) buildIndex() (*indexer.Indexer, error) {
|
||||
func configFromSvc(cfg *config.Config) (*idxcfg.Config, error) {
|
||||
c := idxcfg.New()
|
||||
|
||||
//if cfg.Log == nil {
|
||||
// cfg.Log = &shared.Log{}
|
||||
//}
|
||||
if cfg.Log == nil {
|
||||
cfg.Log = &config.Log{}
|
||||
}
|
||||
|
||||
defer func(cfg *config.Config) {
|
||||
l := log.NewLogger(log.Color(cfg.Log.Color), log.Pretty(cfg.Log.Pretty), log.Level(cfg.Log.Level))
|
||||
|
||||
@@ -14,7 +14,7 @@ var (
|
||||
func Configure(cfg *config.Config) error {
|
||||
var err error
|
||||
if cfg.Tracing.Enabled {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, "accounts", cfg.Tracing.Type); err != nil {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, cfg.Service.Name, cfg.Tracing.Type); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,16 +59,16 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
}
|
||||
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
//if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
// cfg.Log = &shared.Log{
|
||||
// Level: cfg.Commons.Log.Level,
|
||||
// Pretty: cfg.Commons.Log.Pretty,
|
||||
// Color: cfg.Commons.Log.Color,
|
||||
// File: cfg.Commons.Log.File,
|
||||
// }
|
||||
//} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
// cfg.Log = &shared.Log{}
|
||||
//}
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Log = &config.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
Pretty: cfg.Commons.Log.Pretty,
|
||||
Color: cfg.Commons.Log.Color,
|
||||
File: cfg.Commons.Log.File,
|
||||
}
|
||||
} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
cfg.Log = &config.Log{}
|
||||
}
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
envCfg := config.Config{}
|
||||
@@ -91,7 +91,7 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new glauth.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.GLAuth.Commons = cfg.Commons
|
||||
cfg.GLAuth.Commons = cfg.Commons
|
||||
return SutureService{
|
||||
cfg: cfg.GLAuth,
|
||||
}
|
||||
|
||||
@@ -2,14 +2,18 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Service Service
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Log *Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
Ldap Ldap `ocisConfig:"ldap"`
|
||||
|
||||
@@ -12,8 +12,10 @@ func DefaultConfig() *Config {
|
||||
Addr: "127.0.0.1:9129",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Type: "jaeger",
|
||||
Service: "glauth",
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
},
|
||||
Service: Service{
|
||||
Name: "glauth",
|
||||
|
||||
@@ -6,5 +6,4 @@ type Tracing struct {
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;GLAUTH_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;GLAUTH_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;GLAUTH_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"GLAUTH_TRACING_SERVICE"` // TODO:
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
// LoggerFromConfig initializes a service-specific logger instance.
|
||||
func Configure(name string, cfg config.Log) log.Logger {
|
||||
func Configure(name string, cfg *config.Log) log.Logger {
|
||||
return log.NewLogger(
|
||||
log.Name(name),
|
||||
log.Level(cfg.Level),
|
||||
|
||||
@@ -14,7 +14,7 @@ var (
|
||||
func Configure(cfg *config.Config) error {
|
||||
var err error
|
||||
if cfg.Tracing.Enabled {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, "glauth", cfg.Tracing.Type); err != nil {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, cfg.Service.Name, cfg.Tracing.Type); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,17 +56,17 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
//if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
// cfg.Log = &shared.Log{
|
||||
// Level: cfg.Commons.Log.Level,
|
||||
// Pretty: cfg.Commons.Log.Pretty,
|
||||
// Color: cfg.Commons.Log.Color,
|
||||
// File: cfg.Commons.Log.File,
|
||||
// }
|
||||
//} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
// cfg.Log = &shared.Log{}
|
||||
//}
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Log = &config.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
Pretty: cfg.Commons.Log.Pretty,
|
||||
Color: cfg.Commons.Log.Color,
|
||||
File: cfg.Commons.Log.File,
|
||||
}
|
||||
} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
cfg.Log = &config.Log{}
|
||||
}
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
envCfg := config.Config{}
|
||||
|
||||
@@ -2,14 +2,18 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Service Service
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Log *Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
|
||||
@@ -17,10 +17,10 @@ func DefaultConfig() *Config {
|
||||
Name: "graph-explorer",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "graph-explorer",
|
||||
},
|
||||
GraphExplorer: GraphExplorer{
|
||||
ClientID: "ocis-explorer.js",
|
||||
|
||||
@@ -6,5 +6,4 @@ type Tracing struct {
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;GRAPH_EXPLORER_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;GRAPH_EXPLORER_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;GRAPH_EXPLORER_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"GRAPH_EXPLORER_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
// LoggerFromConfig initializes a service-specific logger instance.
|
||||
func Configure(name string, cfg config.Log) log.Logger {
|
||||
func Configure(name string, cfg *config.Log) log.Logger {
|
||||
return log.NewLogger(
|
||||
log.Name(name),
|
||||
log.Level(cfg.Level),
|
||||
|
||||
@@ -14,7 +14,7 @@ var (
|
||||
func Configure(cfg *config.Config) error {
|
||||
var err error
|
||||
if cfg.Tracing.Enabled {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, "graph-explorer", cfg.Tracing.Type); err != nil {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, cfg.Service.Name, cfg.Tracing.Type); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,16 +58,16 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
}
|
||||
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
//if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
// cfg.Log = &shared.Log{
|
||||
// Level: cfg.Commons.Log.Level,
|
||||
// Pretty: cfg.Commons.Log.Pretty,
|
||||
// Color: cfg.Commons.Log.Color,
|
||||
// File: cfg.Commons.Log.File,
|
||||
// }
|
||||
//} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
// cfg.Log = &shared.Log{}
|
||||
//}
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Log = &config.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
Pretty: cfg.Commons.Log.Pretty,
|
||||
Color: cfg.Commons.Log.Color,
|
||||
File: cfg.Commons.Log.File,
|
||||
}
|
||||
} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
cfg.Log = &config.Log{}
|
||||
}
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
envCfg := config.Config{}
|
||||
@@ -90,7 +90,7 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new graph.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.Graph.Commons = cfg.Commons
|
||||
cfg.Graph.Commons = cfg.Commons
|
||||
return SutureService{
|
||||
cfg: cfg.Graph,
|
||||
}
|
||||
|
||||
@@ -2,14 +2,18 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Service Service
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Log *Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
|
||||
@@ -15,9 +15,10 @@ func DefaultConfig() *Config {
|
||||
Name: "graph",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
Service: "graph",
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
},
|
||||
Reva: Reva{
|
||||
Address: "127.0.0.1:9142",
|
||||
|
||||
@@ -6,5 +6,4 @@ type Tracing struct {
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;GRAPH_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;GRAPH_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;GRAPH_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"GRAPH_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
// LoggerFromConfig initializes a service-specific logger instance.
|
||||
func Configure(name string, cfg config.Log) log.Logger {
|
||||
func Configure(name string, cfg *config.Log) log.Logger {
|
||||
return log.NewLogger(
|
||||
log.Name(name),
|
||||
log.Level(cfg.Level),
|
||||
|
||||
@@ -14,7 +14,7 @@ var (
|
||||
func Configure(cfg *config.Config) error {
|
||||
var err error
|
||||
if cfg.Tracing.Enabled {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, "graph", cfg.Tracing.Type); err != nil {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, cfg.Service.Name, cfg.Tracing.Type); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,16 +60,16 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
}
|
||||
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
//if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
// cfg.Log = &shared.Log{
|
||||
// Level: cfg.Commons.Log.Level,
|
||||
// Pretty: cfg.Commons.Log.Pretty,
|
||||
// Color: cfg.Commons.Log.Color,
|
||||
// File: cfg.Commons.Log.File,
|
||||
// }
|
||||
//} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
// cfg.Log = &shared.Log{}
|
||||
//}
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Log = &config.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
Pretty: cfg.Commons.Log.Pretty,
|
||||
Color: cfg.Commons.Log.Color,
|
||||
File: cfg.Commons.Log.File,
|
||||
}
|
||||
} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
cfg.Log = &config.Log{}
|
||||
}
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
envCfg := config.Config{}
|
||||
@@ -92,7 +92,7 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new idp.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.IDP.Commons = cfg.Commons
|
||||
cfg.IDP.Commons = cfg.Commons
|
||||
return SutureService{
|
||||
cfg: cfg.IDP,
|
||||
}
|
||||
|
||||
@@ -2,14 +2,18 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Service Service
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Log *Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
|
||||
@@ -23,10 +23,10 @@ func DefaultConfig() *Config {
|
||||
Name: "idp",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "idp",
|
||||
},
|
||||
Asset: Asset{},
|
||||
IDP: Settings{
|
||||
|
||||
@@ -6,5 +6,4 @@ type Tracing struct {
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;IDP_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;IDP_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;IDP_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"IDP_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
// LoggerFromConfig initializes a service-specific logger instance.
|
||||
func Configure(name string, cfg config.Log) log.Logger {
|
||||
func Configure(name string, cfg *config.Log) log.Logger {
|
||||
return log.NewLogger(
|
||||
log.Name(name),
|
||||
log.Level(cfg.Level),
|
||||
|
||||
@@ -14,7 +14,7 @@ var (
|
||||
func Configure(cfg *config.Config) error {
|
||||
var err error
|
||||
if cfg.Tracing.Enabled {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, "idp", cfg.Tracing.Type); err != nil {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, cfg.Service.Name, cfg.Tracing.Type); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ type Tracing struct {
|
||||
Type string `ocisConfig:"type"`
|
||||
Endpoint string `ocisConfig:"endpoint"`
|
||||
Collector string `ocisConfig:"collector"`
|
||||
Service string `ocisConfig:"service"`
|
||||
}
|
||||
|
||||
// TokenManager is the config for using the reva token manager
|
||||
@@ -42,28 +41,6 @@ const (
|
||||
|
||||
type Mode int
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"ACCOUNTS_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"ACCOUNTS_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"ACCOUNTS_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"ACCOUNTS_DEBUG_ZPAGES"`
|
||||
}
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE"`
|
||||
}
|
||||
|
||||
// Runtime configures the oCIS runtime when running in supervised mode.
|
||||
type Runtime struct {
|
||||
Port string `ocisConfig:"port"`
|
||||
@@ -75,11 +52,8 @@ type Runtime struct {
|
||||
type Config struct {
|
||||
*shared.Commons `ocisConfig:"shared"`
|
||||
|
||||
Service Service `ocisConfig:"service"`
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
Tracing shared.Tracing `ocisConfig:"tracing"`
|
||||
Log shared.Log `ocisConfig:"log"`
|
||||
|
||||
Mode Mode // DEPRECATED
|
||||
File string
|
||||
@@ -106,13 +80,6 @@ type Config struct {
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Tracing: Tracing{
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "ocis",
|
||||
},
|
||||
TokenManager: TokenManager{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
},
|
||||
@@ -189,10 +156,6 @@ func structMappings(cfg *Config) []shared.EnvBinding {
|
||||
EnvVars: []string{"OCIS_TRACING_COLLECTOR"},
|
||||
Destination: &cfg.Tracing.Collector,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_TRACING_SERVICE"},
|
||||
Destination: &cfg.Tracing.Service,
|
||||
},
|
||||
{
|
||||
EnvVars: []string{"OCIS_JWT_SECRET"},
|
||||
Destination: &cfg.TokenManager.JWTSecret,
|
||||
|
||||
@@ -21,7 +21,7 @@ type Logger struct {
|
||||
}
|
||||
|
||||
// LoggerFromConfig initializes a service-specific logger instance.
|
||||
func LoggerFromConfig(name string, cfg shared.Log) Logger {
|
||||
func LoggerFromConfig(name string, cfg *shared.Log) Logger {
|
||||
return NewLogger(
|
||||
Name(name),
|
||||
Level(cfg.Level),
|
||||
|
||||
@@ -16,9 +16,18 @@ type Log struct {
|
||||
File string `mapstructure:"file"`
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled"`
|
||||
Type string `ocisConfig:"type"`
|
||||
Endpoint string `ocisConfig:"endpoint"`
|
||||
Collector string `ocisConfig:"collector"`
|
||||
}
|
||||
|
||||
// Commons holds configuration that are common to all extensions. Each extension can then decide whether
|
||||
// to overwrite its values.
|
||||
type Commons struct {
|
||||
*Log `mapstructure:"log"`
|
||||
Tracing `mapstrucuture:"log"`
|
||||
OcisURL string `mapstructure:"ocis_url"`
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ func AccountsCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.Accounts.Commons = cfg.Commons
|
||||
//}
|
||||
if cfg.Commons != nil {
|
||||
cfg.Accounts.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -18,9 +18,9 @@ func GLAuthCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.GLAuth.Commons = cfg.Commons
|
||||
//}
|
||||
if cfg.Commons != nil {
|
||||
cfg.GLAuth.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -18,9 +18,9 @@ func GraphCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.Graph.Commons = cfg.Commons
|
||||
//}
|
||||
if cfg.Commons != nil {
|
||||
cfg.Graph.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -18,9 +18,9 @@ func GraphExplorerCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.Graph.Commons = cfg.Commons
|
||||
//}
|
||||
if cfg.Commons != nil {
|
||||
cfg.Graph.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -21,9 +21,9 @@ func IDPCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.IDP.Commons = cfg.Commons
|
||||
//}
|
||||
if cfg.Commons != nil {
|
||||
cfg.IDP.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -18,9 +18,9 @@ func OCSCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.OCS.Commons = cfg.Commons
|
||||
//}
|
||||
if cfg.Commons != nil {
|
||||
cfg.OCS.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -21,9 +21,9 @@ func ProxyCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.Proxy.Commons = cfg.Commons
|
||||
//}
|
||||
if cfg.Commons != nil {
|
||||
cfg.Proxy.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -21,9 +21,9 @@ func SettingsCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.Settings.Commons = cfg.Commons
|
||||
//}
|
||||
if cfg.Commons != nil {
|
||||
cfg.Settings.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -21,9 +21,9 @@ func ThumbnailsCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.Thumbnails.Commons = cfg.Commons
|
||||
//}
|
||||
if cfg.Commons != nil {
|
||||
cfg.Thumbnails.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -2,6 +2,7 @@ package command
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -10,16 +11,16 @@ func ParseStorageCommon(ctx *cli.Context, cfg *config.Config) error {
|
||||
return err
|
||||
}
|
||||
|
||||
//if cfg.Storage.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
// cfg.Storage.Log = &shared.Log{
|
||||
// Level: cfg.Commons.Log.Level,
|
||||
// Pretty: cfg.Commons.Log.Pretty,
|
||||
// Color: cfg.Commons.Log.Color,
|
||||
// File: cfg.Commons.Log.File,
|
||||
// }
|
||||
//} else if cfg.Storage.Log == nil && cfg.Commons == nil {
|
||||
// cfg.Storage.Log = &shared.Log{}
|
||||
//}
|
||||
if cfg.Storage.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Storage.Log = &shared.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
Pretty: cfg.Commons.Log.Pretty,
|
||||
Color: cfg.Commons.Log.Color,
|
||||
File: cfg.Commons.Log.File,
|
||||
}
|
||||
} else if cfg.Storage.Log == nil && cfg.Commons == nil {
|
||||
cfg.Storage.Log = &shared.Log{}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ func WebCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.Web.Commons = cfg.Commons
|
||||
//}
|
||||
if cfg.Commons != nil {
|
||||
cfg.Web.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -22,9 +22,9 @@ func WebDAVCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
//if cfg.Commons != nil {
|
||||
// cfg.WebDAV.Commons = cfg.Commons
|
||||
//}
|
||||
if cfg.Commons != nil {
|
||||
cfg.WebDAV.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -164,9 +164,9 @@ func Start(o ...Option) error {
|
||||
}
|
||||
}
|
||||
|
||||
//if s.cfg.Storage.Log == nil {
|
||||
// s.cfg.Storage.Log = &shared.Log{}
|
||||
//}
|
||||
if s.cfg.Storage.Log == nil {
|
||||
s.cfg.Storage.Log = &shared.Log{}
|
||||
}
|
||||
|
||||
s.cfg.Storage.Log.Color = s.cfg.Commons.Color
|
||||
s.cfg.Storage.Log.Level = s.cfg.Commons.Level
|
||||
|
||||
@@ -61,16 +61,16 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
}
|
||||
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
//if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
// cfg.Log = &shared.Log{
|
||||
// Level: cfg.Commons.Log.Level,
|
||||
// Pretty: cfg.Commons.Log.Pretty,
|
||||
// Color: cfg.Commons.Log.Color,
|
||||
// File: cfg.Commons.Log.File,
|
||||
// }
|
||||
//} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
// cfg.Log = &shared.Log{}
|
||||
//}
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Log = &config.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
Pretty: cfg.Commons.Log.Pretty,
|
||||
Color: cfg.Commons.Log.Color,
|
||||
File: cfg.Commons.Log.File,
|
||||
}
|
||||
} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
cfg.Log = &config.Log{}
|
||||
}
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
envCfg := config.Config{}
|
||||
@@ -93,7 +93,7 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new ocs.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.OCS.Commons = cfg.Commons
|
||||
cfg.OCS.Commons = cfg.Commons
|
||||
return SutureService{
|
||||
cfg: cfg.OCS,
|
||||
}
|
||||
|
||||
@@ -2,14 +2,18 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Service Service
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Log *Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
|
||||
@@ -27,7 +27,6 @@ func DefaultConfig() *Config {
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "ocs",
|
||||
},
|
||||
TokenManager: TokenManager{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
|
||||
@@ -6,5 +6,4 @@ type Tracing struct {
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;OCS_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;OCS_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;OCS_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"OCS_TRACING_SERVICE"`
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
// LoggerFromConfig initializes a service-specific logger instance.
|
||||
func Configure(name string, cfg config.Log) log.Logger {
|
||||
func Configure(name string, cfg *config.Log) log.Logger {
|
||||
return log.NewLogger(
|
||||
log.Name(name),
|
||||
log.Level(cfg.Level),
|
||||
|
||||
@@ -14,7 +14,7 @@ var (
|
||||
func Configure(cfg *config.Config) error {
|
||||
var err error
|
||||
if cfg.Tracing.Enabled {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, "ocs", cfg.Tracing.Type); err != nil {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, cfg.Service.Name, cfg.Tracing.Type); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,16 +60,16 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
}
|
||||
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
//if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
// cfg.Log = &shared.Log{
|
||||
// Level: cfg.Commons.Log.Level,
|
||||
// Pretty: cfg.Commons.Log.Pretty,
|
||||
// Color: cfg.Commons.Log.Color,
|
||||
// File: cfg.Commons.Log.File,
|
||||
// }
|
||||
//} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
// cfg.Log = &shared.Log{}
|
||||
//}
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Log = &config.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
Pretty: cfg.Commons.Log.Pretty,
|
||||
Color: cfg.Commons.Log.Color,
|
||||
File: cfg.Commons.Log.File,
|
||||
}
|
||||
} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
cfg.Log = &config.Log{}
|
||||
}
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
envCfg := config.Config{}
|
||||
@@ -92,7 +92,7 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new proxy.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.Proxy.Commons = cfg.Commons
|
||||
cfg.Proxy.Commons = cfg.Commons
|
||||
return SutureService{
|
||||
cfg: cfg.Proxy,
|
||||
}
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
package config
|
||||
|
||||
import "context"
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Service Service
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Log *Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
|
||||
@@ -24,10 +24,10 @@ func DefaultConfig() *Config {
|
||||
Name: "proxy",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Enabled: false,
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "proxy",
|
||||
},
|
||||
OIDC: OIDC{
|
||||
Issuer: "https://localhost:9200",
|
||||
|
||||
@@ -6,5 +6,4 @@ type Tracing struct {
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;PROXY_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;PROXY_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;PROXY_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"PROXY_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
// LoggerFromConfig initializes a service-specific logger instance.
|
||||
func Configure(name string, cfg config.Log) log.Logger {
|
||||
func Configure(name string, cfg *config.Log) log.Logger {
|
||||
return log.NewLogger(
|
||||
log.Name(name),
|
||||
log.Level(cfg.Level),
|
||||
|
||||
@@ -14,7 +14,7 @@ var (
|
||||
func Configure(cfg *config.Config) error {
|
||||
var err error
|
||||
if cfg.Tracing.Enabled {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, "proxy", cfg.Tracing.Type); err != nil {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, cfg.Service.Name, cfg.Tracing.Type); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,16 +61,16 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
}
|
||||
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
//if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
// cfg.Log = &shared.Log{
|
||||
// Level: cfg.Commons.Log.Level,
|
||||
// Pretty: cfg.Commons.Log.Pretty,
|
||||
// Color: cfg.Commons.Log.Color,
|
||||
// File: cfg.Commons.Log.File,
|
||||
// }
|
||||
//} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
// cfg.Log = &shared.Log{}
|
||||
//}
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Log = &config.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
Pretty: cfg.Commons.Log.Pretty,
|
||||
Color: cfg.Commons.Log.Color,
|
||||
File: cfg.Commons.Log.File,
|
||||
}
|
||||
} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
cfg.Log = &config.Log{}
|
||||
}
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
envCfg := config.Config{}
|
||||
@@ -93,7 +93,7 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new settings.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.Settings.Commons = cfg.Commons
|
||||
cfg.Settings.Commons = cfg.Commons
|
||||
return SutureService{
|
||||
cfg: cfg.Settings,
|
||||
}
|
||||
|
||||
@@ -2,14 +2,18 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Service Service
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Log *Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
HTTP HTTP `ocisConfig:"http"`
|
||||
@@ -27,4 +31,3 @@ type Config struct {
|
||||
type Asset struct {
|
||||
Path string `ocisConfig:"path" env:"SETTINGS_ASSET_PATH"`
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ func DefaultConfig() *Config {
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "settings",
|
||||
},
|
||||
DataPath: path.Join(defaults.BaseDataPath(), "settings"),
|
||||
Asset: Asset{
|
||||
|
||||
@@ -6,5 +6,4 @@ type Tracing struct {
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;SETTINGS_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;SETTINGS_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;SETTINGS_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"SETTINGS_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
// LoggerFromConfig initializes a service-specific logger instance.
|
||||
func Configure(name string, cfg config.Log) log.Logger {
|
||||
func Configure(name string, cfg *config.Log) log.Logger {
|
||||
return log.NewLogger(
|
||||
log.Name(name),
|
||||
log.Level(cfg.Level),
|
||||
|
||||
@@ -14,7 +14,7 @@ var (
|
||||
func Configure(cfg *config.Config) error {
|
||||
var err error
|
||||
if cfg.Tracing.Enabled {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, "settings", cfg.Tracing.Type); err != nil {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, cfg.Service.Name, cfg.Tracing.Type); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
"github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/logging"
|
||||
"github.com/owncloud/ocis/storage/pkg/server/debug"
|
||||
"github.com/owncloud/ocis/storage/pkg/tracing"
|
||||
"github.com/thejerf/suture/v4"
|
||||
@@ -28,7 +27,7 @@ func AppProvider(cfg *config.Config) *cli.Command {
|
||||
return ParseConfig(c, cfg, "storage-app-provider")
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||
logger := NewLogger(cfg)
|
||||
tracing.Configure(cfg, logger)
|
||||
gr := run.Group{}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
@@ -129,7 +128,7 @@ type AppProviderSutureService struct {
|
||||
|
||||
// NewAppProvider creates a new store.AppProviderSutureService
|
||||
func NewAppProvider(cfg *ociscfg.Config) suture.Service {
|
||||
////cfg.Storage.Commons = cfg.Commons
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
return AppProviderSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
"github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/logging"
|
||||
"github.com/owncloud/ocis/storage/pkg/server/debug"
|
||||
"github.com/owncloud/ocis/storage/pkg/tracing"
|
||||
"github.com/thejerf/suture/v4"
|
||||
@@ -29,7 +28,7 @@ func AuthBasic(cfg *config.Config) *cli.Command {
|
||||
return ParseConfig(c, cfg, "storage-auth-basic")
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||
logger := NewLogger(cfg)
|
||||
tracing.Configure(cfg, logger)
|
||||
gr := run.Group{}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
@@ -148,7 +147,7 @@ type AuthBasicSutureService struct {
|
||||
|
||||
// NewAuthBasicSutureService creates a new store.AuthBasicSutureService
|
||||
func NewAuthBasic(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
return AuthBasicSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
"github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/logging"
|
||||
"github.com/owncloud/ocis/storage/pkg/server/debug"
|
||||
"github.com/owncloud/ocis/storage/pkg/tracing"
|
||||
"github.com/thejerf/suture/v4"
|
||||
@@ -28,7 +27,7 @@ func AuthBearer(cfg *config.Config) *cli.Command {
|
||||
return ParseConfig(c, cfg, "storage-auth-bearer")
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||
logger := NewLogger(cfg)
|
||||
tracing.Configure(cfg, logger)
|
||||
gr := run.Group{}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
@@ -124,7 +123,7 @@ type AuthBearerSutureService struct {
|
||||
|
||||
// NewAuthBearerSutureService creates a new gateway.AuthBearerSutureService
|
||||
func NewAuthBearer(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
return AuthBearerSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
"github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/logging"
|
||||
"github.com/owncloud/ocis/storage/pkg/server/debug"
|
||||
"github.com/owncloud/ocis/storage/pkg/tracing"
|
||||
"github.com/thejerf/suture/v4"
|
||||
@@ -28,7 +27,7 @@ func AuthMachine(cfg *config.Config) *cli.Command {
|
||||
return ParseConfig(c, cfg, "storage-auth-machine")
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||
logger := NewLogger(cfg)
|
||||
tracing.Configure(cfg, logger)
|
||||
gr := run.Group{}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
@@ -120,7 +119,7 @@ type AuthMachineSutureService struct {
|
||||
|
||||
// NewAuthMachineSutureService creates a new gateway.AuthMachineSutureService
|
||||
func NewAuthMachine(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
return AuthMachineSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/conversions"
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
"github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/logging"
|
||||
"github.com/owncloud/ocis/storage/pkg/server/debug"
|
||||
"github.com/owncloud/ocis/storage/pkg/tracing"
|
||||
"github.com/thejerf/suture/v4"
|
||||
@@ -35,7 +34,7 @@ func Frontend(cfg *config.Config) *cli.Command {
|
||||
return ParseConfig(c, cfg, "storage-frontend")
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
tracing.Configure(cfg, logger)
|
||||
|
||||
@@ -339,7 +338,7 @@ type FrontendSutureService struct {
|
||||
|
||||
// NewFrontend creates a new frontend.FrontendSutureService
|
||||
func NewFrontend(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
return FrontendSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@ import (
|
||||
"github.com/oklog/run"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/logging"
|
||||
"github.com/owncloud/ocis/storage/pkg/server/debug"
|
||||
"github.com/owncloud/ocis/storage/pkg/service/external"
|
||||
"github.com/owncloud/ocis/storage/pkg/tracing"
|
||||
@@ -43,7 +43,7 @@ func Gateway(cfg *config.Config) *cli.Command {
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||
logger := NewLogger(cfg)
|
||||
tracing.Configure(cfg, logger)
|
||||
gr := run.Group{}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
@@ -352,7 +352,7 @@ type GatewaySutureService struct {
|
||||
|
||||
// NewGatewaySutureService creates a new gateway.GatewaySutureService
|
||||
func NewGateway(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
return GatewaySutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
@@ -388,16 +388,16 @@ func ParseConfig(c *cli.Context, cfg *config.Config, storageExtension string) er
|
||||
}
|
||||
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
//if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
// cfg.Log = &shared.Log{
|
||||
// Level: cfg.Commons.Log.Level,
|
||||
// Pretty: cfg.Commons.Log.Pretty,
|
||||
// Color: cfg.Commons.Log.Color,
|
||||
// File: cfg.Commons.Log.File,
|
||||
// }
|
||||
//} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
// cfg.Log = &shared.Log{}
|
||||
//}
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Log = &shared.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
Pretty: cfg.Commons.Log.Pretty,
|
||||
Color: cfg.Commons.Log.Color,
|
||||
File: cfg.Commons.Log.File,
|
||||
}
|
||||
} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
cfg.Log = &shared.Log{}
|
||||
}
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
conf.LoadOSEnv(config.GetEnv(cfg), false)
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
"github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/logging"
|
||||
"github.com/owncloud/ocis/storage/pkg/server/debug"
|
||||
"github.com/owncloud/ocis/storage/pkg/tracing"
|
||||
"github.com/thejerf/suture/v4"
|
||||
@@ -29,7 +28,7 @@ func Groups(cfg *config.Config) *cli.Command {
|
||||
return ParseConfig(c, cfg, "storage-groups")
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||
logger := NewLogger(cfg)
|
||||
tracing.Configure(cfg, logger)
|
||||
gr := run.Group{}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
@@ -162,7 +161,7 @@ type GroupSutureService struct {
|
||||
|
||||
// NewGroupProviderSutureService creates a new storage.GroupProvider
|
||||
func NewGroupProvider(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
return GroupSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/logging"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -18,7 +17,7 @@ func Health(cfg *config.Config) *cli.Command {
|
||||
return ParseConfig(c, cfg, "storage")
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
resp, err := http.Get(
|
||||
fmt.Sprintf(
|
||||
|
||||
@@ -3,6 +3,7 @@ package command
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/urfave/cli/v2"
|
||||
@@ -22,10 +23,8 @@ func Execute(cfg *config.Config) error {
|
||||
Email: "support@owncloud.com",
|
||||
},
|
||||
},
|
||||
|
||||
Before: func(c *cli.Context) error {
|
||||
cfg.Service.Version = version.String
|
||||
return ParseConfig(c, cfg, "_")
|
||||
return ParseConfig(c, cfg, "storage")
|
||||
},
|
||||
|
||||
Commands: []*cli.Command{
|
||||
@@ -36,7 +35,6 @@ func Execute(cfg *config.Config) error {
|
||||
AppProvider(cfg),
|
||||
AuthBasic(cfg),
|
||||
AuthBearer(cfg),
|
||||
AuthMachine(cfg),
|
||||
Sharing(cfg),
|
||||
StorageHome(cfg),
|
||||
StorageUsers(cfg),
|
||||
@@ -58,3 +56,14 @@ func Execute(cfg *config.Config) error {
|
||||
|
||||
return app.Run(os.Args)
|
||||
}
|
||||
|
||||
// NewLogger initializes a service-specific logger instance.
|
||||
func NewLogger(cfg *config.Config) log.Logger {
|
||||
return log.NewLogger(
|
||||
log.Name("storage"),
|
||||
log.Level(cfg.Log.Level),
|
||||
log.Pretty(cfg.Log.Pretty),
|
||||
log.Color(cfg.Log.Color),
|
||||
log.File(cfg.Log.File),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"path"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/owncloud/ocis/storage/pkg/logging"
|
||||
"github.com/owncloud/ocis/storage/pkg/tracing"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
@@ -31,7 +30,7 @@ func Sharing(cfg *config.Config) *cli.Command {
|
||||
return ParseConfig(c, cfg, "storage-sharing")
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
tracing.Configure(cfg, logger)
|
||||
|
||||
@@ -188,7 +187,7 @@ type SharingSutureService struct {
|
||||
|
||||
// NewSharingSutureService creates a new store.SharingSutureService
|
||||
func NewSharing(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
return SharingSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
"github.com/owncloud/ocis/storage/pkg/logging"
|
||||
|
||||
"github.com/cs3org/reva/cmd/revad/runtime"
|
||||
"github.com/gofrs/uuid"
|
||||
@@ -30,7 +29,7 @@ func StorageHome(cfg *config.Config) *cli.Command {
|
||||
return ParseConfig(c, cfg, "storage-home")
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
tracing.Configure(cfg, logger)
|
||||
|
||||
@@ -147,7 +146,7 @@ type StorageHomeSutureService struct {
|
||||
|
||||
// NewStorageHomeSutureService creates a new storage.StorageHomeSutureService
|
||||
func NewStorageHome(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
return StorageHomeSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
"github.com/owncloud/ocis/storage/pkg/logging"
|
||||
|
||||
"github.com/cs3org/reva/cmd/revad/runtime"
|
||||
"github.com/gofrs/uuid"
|
||||
@@ -35,7 +34,7 @@ func StorageMetadata(cfg *config.Config) *cli.Command {
|
||||
},
|
||||
Category: "Extensions",
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||
logger := NewLogger(cfg)
|
||||
tracing.Configure(cfg, logger)
|
||||
|
||||
gr := run.Group{}
|
||||
@@ -167,7 +166,7 @@ type MetadataSutureService struct {
|
||||
|
||||
// NewSutureService creates a new storagemetadata.SutureService
|
||||
func NewStorageMetadata(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
return MetadataSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
"github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/logging"
|
||||
"github.com/owncloud/ocis/storage/pkg/server/debug"
|
||||
"github.com/owncloud/ocis/storage/pkg/tracing"
|
||||
"github.com/thejerf/suture/v4"
|
||||
@@ -29,7 +28,7 @@ func StoragePublicLink(cfg *config.Config) *cli.Command {
|
||||
},
|
||||
Category: "Extensions",
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||
logger := NewLogger(cfg)
|
||||
tracing.Configure(cfg, logger)
|
||||
gr := run.Group{}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
@@ -127,7 +126,7 @@ type StoragePublicLinkSutureService struct {
|
||||
|
||||
// NewStoragePublicLinkSutureService creates a new storage.StoragePublicLinkSutureService
|
||||
func NewStoragePublicLink(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
return StoragePublicLinkSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
"github.com/owncloud/ocis/storage/pkg/command/storagedrivers"
|
||||
"github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/logging"
|
||||
"github.com/owncloud/ocis/storage/pkg/server/debug"
|
||||
"github.com/owncloud/ocis/storage/pkg/tracing"
|
||||
"github.com/thejerf/suture/v4"
|
||||
@@ -29,7 +28,7 @@ func StorageUsers(cfg *config.Config) *cli.Command {
|
||||
return ParseConfig(c, cfg, "storage-userprovider")
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
tracing.Configure(cfg, logger)
|
||||
|
||||
@@ -147,7 +146,7 @@ type StorageUsersSutureService struct {
|
||||
|
||||
// NewStorageUsersSutureService creates a new storage.StorageUsersSutureService
|
||||
func NewStorageUsers(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
return StorageUsersSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
||||
"github.com/owncloud/ocis/storage/pkg/config"
|
||||
"github.com/owncloud/ocis/storage/pkg/logging"
|
||||
"github.com/owncloud/ocis/storage/pkg/server/debug"
|
||||
"github.com/owncloud/ocis/storage/pkg/tracing"
|
||||
"github.com/thejerf/suture/v4"
|
||||
@@ -29,7 +28,7 @@ func Users(cfg *config.Config) *cli.Command {
|
||||
return ParseConfig(c, cfg, "storage-users")
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
tracing.Configure(cfg, logger)
|
||||
|
||||
@@ -183,7 +182,7 @@ type UserProviderSutureService struct {
|
||||
|
||||
// NewUserProviderSutureService creates a new storage.UserProvider
|
||||
func NewUserProvider(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.Storage.Commons = cfg.Commons
|
||||
cfg.Storage.Commons = cfg.Commons
|
||||
return UserProviderSutureService{
|
||||
cfg: cfg.Storage,
|
||||
}
|
||||
|
||||
@@ -2,21 +2,28 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
Service Service
|
||||
// Log defines the available logging configuration.
|
||||
type Log struct {
|
||||
Level string `ocisConfig:"level"`
|
||||
Pretty bool `ocisConfig:"pretty"`
|
||||
Color bool `ocisConfig:"color"`
|
||||
File string `ocisConfig:"file"`
|
||||
}
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
Reva Reva `ocisConfig:"reva"`
|
||||
|
||||
Asset Asset `ocisConfig:"asset"`
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr"`
|
||||
Token string `ocisConfig:"token"`
|
||||
Pprof bool `ocisConfig:"pprof"`
|
||||
Zpages bool `ocisConfig:"zpages"`
|
||||
}
|
||||
|
||||
// Gateway defines the available gateway configuration.
|
||||
@@ -483,11 +490,472 @@ type Reva struct {
|
||||
DefaultUploadProtocol string `ocisConfig:"default_upload_protocol"`
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled"`
|
||||
Type string `ocisConfig:"type"`
|
||||
Endpoint string `ocisConfig:"endpoint"`
|
||||
Collector string `ocisConfig:"collector"`
|
||||
Service string `ocisConfig:"service"`
|
||||
}
|
||||
|
||||
// Asset defines the available asset configuration.
|
||||
type Asset struct {
|
||||
Path string `ocisConfig:"path"`
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
File string `ocisConfig:"file"`
|
||||
Log *shared.Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
Reva Reva `ocisConfig:"reva"`
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Asset Asset `ocisConfig:"asset"`
|
||||
}
|
||||
|
||||
// New initializes a new configuration with or without defaults.
|
||||
func New() *Config {
|
||||
return &Config{}
|
||||
}
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
// log is inherited
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9109",
|
||||
},
|
||||
Reva: Reva{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
SkipUserGroupsInToken: false,
|
||||
TransferSecret: "replace-me-with-a-transfer-secret",
|
||||
TransferExpires: 24 * 60 * 60,
|
||||
OIDC: OIDC{
|
||||
Issuer: "https://localhost:9200",
|
||||
Insecure: false,
|
||||
IDClaim: "preferred_username",
|
||||
},
|
||||
LDAP: LDAP{
|
||||
Hostname: "localhost",
|
||||
Port: 9126,
|
||||
CACert: path.Join(defaults.BaseDataPath(), "ldap", "ldap.crt"),
|
||||
Insecure: false,
|
||||
BaseDN: "dc=ocis,dc=test",
|
||||
LoginFilter: "(&(objectclass=posixAccount)(|(cn={{login}})(mail={{login}})))",
|
||||
UserFilter: "(&(objectclass=posixAccount)(|(ownclouduuid={{.OpaqueId}})(cn={{.OpaqueId}})))",
|
||||
UserAttributeFilter: "(&(objectclass=posixAccount)({{attr}}={{value}}))",
|
||||
UserFindFilter: "(&(objectclass=posixAccount)(|(cn={{query}}*)(displayname={{query}}*)(mail={{query}}*)))",
|
||||
UserGroupFilter: "(&(objectclass=posixGroup)(ownclouduuid={{.OpaqueId}}*))",
|
||||
GroupFilter: "(&(objectclass=posixGroup)(|(ownclouduuid={{.OpaqueId}})(cn={{.OpaqueId}})))",
|
||||
GroupAttributeFilter: "(&(objectclass=posixGroup)({{attr}}={{value}}))",
|
||||
GroupFindFilter: "(&(objectclass=posixGroup)(|(cn={{query}}*)(displayname={{query}}*)(mail={{query}}*)))",
|
||||
GroupMemberFilter: "(&(objectclass=posixAccount)(ownclouduuid={{.OpaqueId}}*))",
|
||||
BindDN: "cn=reva,ou=sysusers,dc=ocis,dc=test",
|
||||
BindPassword: "reva",
|
||||
IDP: "https://localhost:9200",
|
||||
UserSchema: LDAPUserSchema{
|
||||
UID: "ownclouduuid",
|
||||
Mail: "mail",
|
||||
DisplayName: "displayname",
|
||||
CN: "cn",
|
||||
UIDNumber: "uidnumber",
|
||||
GIDNumber: "gidnumber",
|
||||
},
|
||||
GroupSchema: LDAPGroupSchema{
|
||||
GID: "cn",
|
||||
Mail: "mail",
|
||||
DisplayName: "cn",
|
||||
CN: "cn",
|
||||
GIDNumber: "gidnumber",
|
||||
},
|
||||
},
|
||||
UserGroupRest: UserGroupRest{
|
||||
RedisAddress: "localhost:6379",
|
||||
},
|
||||
UserOwnCloudSQL: UserOwnCloudSQL{
|
||||
DBUsername: "owncloud",
|
||||
DBPassword: "secret",
|
||||
DBHost: "mysql",
|
||||
DBPort: 3306,
|
||||
DBName: "owncloud",
|
||||
Idp: "https://localhost:9200",
|
||||
Nobody: 90,
|
||||
JoinUsername: false,
|
||||
JoinOwnCloudUUID: false,
|
||||
EnableMedialSearch: false,
|
||||
},
|
||||
OCDav: OCDav{
|
||||
WebdavNamespace: "/home/",
|
||||
DavFilesNamespace: "/users/",
|
||||
},
|
||||
Archiver: Archiver{
|
||||
MaxNumFiles: 10000,
|
||||
MaxSize: 1073741824,
|
||||
ArchiverURL: "/archiver",
|
||||
},
|
||||
UserStorage: StorageConfig{
|
||||
EOS: DriverEOS{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: "/eos/dockertest/reva",
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{substr 0 1 .Username}}/{{.Username}}",
|
||||
},
|
||||
ShadowNamespace: "", // Defaults to path.Join(c.Namespace, ".shadow")
|
||||
UploadsNamespace: "", // Defaults to path.Join(c.Namespace, ".uploads")
|
||||
EosBinary: "/usr/bin/eos",
|
||||
XrdcopyBinary: "/usr/bin/xrdcopy",
|
||||
MasterURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
|
||||
SlaveURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
|
||||
CacheDirectory: os.TempDir(),
|
||||
GatewaySVC: "127.0.0.1:9142",
|
||||
},
|
||||
Local: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "local", "users"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Username}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
OwnCloud: DriverOwnCloud{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "owncloud"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
UploadInfoDir: path.Join(defaults.BaseDataPath(), "storage", "uploadinfo"),
|
||||
Redis: ":6379",
|
||||
Scan: true,
|
||||
},
|
||||
OwnCloudSQL: DriverOwnCloudSQL{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "owncloud"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Username}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
UploadInfoDir: path.Join(defaults.BaseDataPath(), "storage", "uploadinfo"),
|
||||
DBUsername: "owncloud",
|
||||
DBPassword: "owncloud",
|
||||
DBHost: "",
|
||||
DBPort: 3306,
|
||||
DBName: "owncloud",
|
||||
},
|
||||
S3: DriverS3{
|
||||
DriverCommon: DriverCommon{},
|
||||
Region: "default",
|
||||
AccessKey: "",
|
||||
SecretKey: "",
|
||||
Endpoint: "",
|
||||
Bucket: "",
|
||||
},
|
||||
S3NG: DriverS3NG{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "users"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
ServiceUserUUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
Region: "default",
|
||||
AccessKey: "",
|
||||
SecretKey: "",
|
||||
Endpoint: "",
|
||||
Bucket: "",
|
||||
},
|
||||
OCIS: DriverOCIS{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "users"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
},
|
||||
ServiceUserUUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
},
|
||||
},
|
||||
MetadataStorage: StorageConfig{
|
||||
EOS: DriverEOS{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: "/eos/dockertest/reva",
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{substr 0 1 .Username}}/{{.Username}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
ShadowNamespace: "",
|
||||
UploadsNamespace: "",
|
||||
EosBinary: "/usr/bin/eos",
|
||||
XrdcopyBinary: "/usr/bin/xrdcopy",
|
||||
MasterURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
|
||||
GrpcURI: "",
|
||||
SlaveURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
|
||||
CacheDirectory: os.TempDir(),
|
||||
EnableLogging: false,
|
||||
ShowHiddenSysFiles: false,
|
||||
ForceSingleUserMode: false,
|
||||
UseKeytab: false,
|
||||
SecProtocol: "",
|
||||
Keytab: "",
|
||||
SingleUsername: "",
|
||||
GatewaySVC: "127.0.0.1:9142",
|
||||
},
|
||||
Local: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "local", "metadata"),
|
||||
},
|
||||
OwnCloud: DriverOwnCloud{},
|
||||
OwnCloudSQL: DriverOwnCloudSQL{},
|
||||
S3: DriverS3{
|
||||
DriverCommon: DriverCommon{},
|
||||
Region: "default",
|
||||
},
|
||||
S3NG: DriverS3NG{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "metadata"),
|
||||
ShareFolder: "",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
ServiceUserUUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
Region: "default",
|
||||
AccessKey: "",
|
||||
SecretKey: "",
|
||||
Endpoint: "",
|
||||
Bucket: "",
|
||||
},
|
||||
OCIS: DriverOCIS{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "metadata"),
|
||||
ShareFolder: "",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
ServiceUserUUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
},
|
||||
},
|
||||
Frontend: FrontendPort{
|
||||
Port: Port{
|
||||
MaxCPUs: "",
|
||||
LogLevel: "",
|
||||
GRPCNetwork: "",
|
||||
GRPCAddr: "",
|
||||
HTTPNetwork: "tcp",
|
||||
HTTPAddr: "127.0.0.1:9140",
|
||||
Protocol: "",
|
||||
Endpoint: "",
|
||||
DebugAddr: "127.0.0.1:9141",
|
||||
Services: []string{"datagateway", "ocdav", "ocs", "appprovider"},
|
||||
Config: nil,
|
||||
Context: nil,
|
||||
Supervised: false,
|
||||
},
|
||||
AppProviderInsecure: false,
|
||||
AppProviderPrefix: "",
|
||||
ArchiverInsecure: false,
|
||||
ArchiverPrefix: "archiver",
|
||||
DatagatewayPrefix: "data",
|
||||
Favorites: false,
|
||||
OCDavInsecure: false,
|
||||
OCDavPrefix: "",
|
||||
OCSPrefix: "ocs",
|
||||
OCSSharePrefix: "/Shares",
|
||||
OCSHomeNamespace: "/home",
|
||||
PublicURL: "https://localhost:9200",
|
||||
OCSCacheWarmupDriver: "",
|
||||
OCSAdditionalInfoAttribute: "{{.Mail}}",
|
||||
OCSResourceInfoCacheTTL: 0,
|
||||
Middleware: Middleware{},
|
||||
},
|
||||
DataGateway: DataGatewayPort{
|
||||
Port: Port{},
|
||||
PublicURL: "",
|
||||
},
|
||||
Gateway: Gateway{
|
||||
Port: Port{
|
||||
Endpoint: "127.0.0.1:9142",
|
||||
DebugAddr: "127.0.0.1:9143",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9142",
|
||||
},
|
||||
CommitShareToStorageGrant: true,
|
||||
CommitShareToStorageRef: true,
|
||||
DisableHomeCreationOnLogin: false,
|
||||
ShareFolder: "Shares",
|
||||
LinkGrants: "",
|
||||
HomeMapping: "",
|
||||
EtagCacheTTL: 0,
|
||||
},
|
||||
StorageRegistry: StorageRegistry{
|
||||
Driver: "static",
|
||||
HomeProvider: "/home",
|
||||
JSON: "",
|
||||
},
|
||||
AppRegistry: AppRegistry{
|
||||
Driver: "static",
|
||||
MimetypesJSON: "",
|
||||
},
|
||||
Users: Users{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9144",
|
||||
DebugAddr: "127.0.0.1:9145",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9144",
|
||||
Services: []string{"userprovider"},
|
||||
},
|
||||
Driver: "ldap",
|
||||
UserGroupsCacheExpiration: 5,
|
||||
},
|
||||
Groups: Groups{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9160",
|
||||
DebugAddr: "127.0.0.1:9161",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9160",
|
||||
Services: []string{"groupprovider"},
|
||||
},
|
||||
Driver: "ldap",
|
||||
GroupMembersCacheExpiration: 5,
|
||||
},
|
||||
AuthProvider: Users{
|
||||
Port: Port{},
|
||||
Driver: "ldap",
|
||||
UserGroupsCacheExpiration: 0,
|
||||
},
|
||||
AuthBasic: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9146",
|
||||
DebugAddr: "127.0.0.1:9147",
|
||||
Services: []string{"authprovider"},
|
||||
Endpoint: "localhost:9146",
|
||||
},
|
||||
AuthBearer: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9148",
|
||||
DebugAddr: "127.0.0.1:9149",
|
||||
Services: []string{"authprovider"},
|
||||
Endpoint: "localhost:9148",
|
||||
},
|
||||
AuthMachine: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9166",
|
||||
DebugAddr: "127.0.0.1:9167",
|
||||
Services: []string{"authprovider"},
|
||||
Endpoint: "localhost:9166",
|
||||
},
|
||||
AuthMachineConfig: AuthMachineConfig{
|
||||
MachineAuthAPIKey: "change-me-please",
|
||||
},
|
||||
Sharing: Sharing{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9150",
|
||||
DebugAddr: "127.0.0.1:9151",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9150",
|
||||
Services: []string{"usershareprovider", "publicshareprovider"},
|
||||
},
|
||||
UserDriver: "json",
|
||||
UserJSONFile: path.Join(defaults.BaseDataPath(), "storage", "shares.json"),
|
||||
UserSQLUsername: "",
|
||||
UserSQLPassword: "",
|
||||
UserSQLHost: "",
|
||||
UserSQLPort: 1433,
|
||||
UserSQLName: "",
|
||||
PublicDriver: "json",
|
||||
PublicJSONFile: path.Join(defaults.BaseDataPath(), "storage", "publicshares.json"),
|
||||
PublicPasswordHashCost: 11,
|
||||
PublicEnableExpiredSharesCleanup: true,
|
||||
PublicJanitorRunInterval: 60,
|
||||
UserStorageMountID: "",
|
||||
},
|
||||
StorageHome: StoragePort{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9154",
|
||||
DebugAddr: "127.0.0.1:9156",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9154",
|
||||
HTTPNetwork: "tcp",
|
||||
HTTPAddr: "127.0.0.1:9155",
|
||||
},
|
||||
Driver: "ocis",
|
||||
ReadOnly: false,
|
||||
MountPath: "/home",
|
||||
AlternativeID: "1284d238-aa92-42ce-bdc4-0b0000009154",
|
||||
MountID: "1284d238-aa92-42ce-bdc4-0b0000009157",
|
||||
DataServerURL: "http://localhost:9155/data",
|
||||
HTTPPrefix: "data",
|
||||
TempFolder: path.Join(defaults.BaseDataPath(), "tmp", "home"),
|
||||
},
|
||||
StorageUsers: StoragePort{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9157",
|
||||
DebugAddr: "127.0.0.1:9159",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9157",
|
||||
HTTPNetwork: "tcp",
|
||||
HTTPAddr: "127.0.0.1:9158",
|
||||
},
|
||||
MountPath: "/users",
|
||||
MountID: "1284d238-aa92-42ce-bdc4-0b0000009157",
|
||||
Driver: "ocis",
|
||||
DataServerURL: "http://localhost:9158/data",
|
||||
HTTPPrefix: "data",
|
||||
TempFolder: path.Join(defaults.BaseDataPath(), "tmp", "users"),
|
||||
},
|
||||
StoragePublicLink: PublicStorage{
|
||||
StoragePort: StoragePort{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9178",
|
||||
DebugAddr: "127.0.0.1:9179",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9178",
|
||||
},
|
||||
MountPath: "/public",
|
||||
MountID: "e1a73ede-549b-4226-abdf-40e69ca8230d",
|
||||
},
|
||||
PublicShareProviderAddr: "",
|
||||
UserProviderAddr: "",
|
||||
},
|
||||
StorageMetadata: StoragePort{
|
||||
Port: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9215",
|
||||
HTTPNetwork: "tcp",
|
||||
HTTPAddr: "127.0.0.1:9216",
|
||||
DebugAddr: "127.0.0.1:9217",
|
||||
},
|
||||
Driver: "ocis",
|
||||
ExposeDataServer: false,
|
||||
DataServerURL: "http://localhost:9216/data",
|
||||
TempFolder: path.Join(defaults.BaseDataPath(), "tmp", "metadata"),
|
||||
DataProvider: DataProvider{},
|
||||
},
|
||||
AppProvider: AppProvider{
|
||||
Port: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9164",
|
||||
DebugAddr: "127.0.0.1:9165",
|
||||
Endpoint: "localhost:9164",
|
||||
Services: []string{"appprovider"},
|
||||
},
|
||||
ExternalAddr: "127.0.0.1:9164",
|
||||
WopiDriver: WopiDriver{},
|
||||
AppsURL: "/app/list",
|
||||
OpenURL: "/app/open",
|
||||
NewURL: "/app/new",
|
||||
},
|
||||
Configs: nil,
|
||||
UploadMaxChunkSize: 1e+8,
|
||||
UploadHTTPMethodOverride: "",
|
||||
ChecksumSupportedTypes: []string{"sha1", "md5", "adler32"},
|
||||
ChecksumPreferredUploadType: "",
|
||||
DefaultUploadProtocol: "tus",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Service: "storage",
|
||||
Type: "jaeger",
|
||||
},
|
||||
Asset: Asset{},
|
||||
}
|
||||
}
|
||||
|
||||
// StructMappings binds a set of environment variables to a destination on cfg. Iterating over this set and editing the
|
||||
// Destination value of a binding will alter the original value, as it is a pointer to its memory address. This lets
|
||||
// us propagate changes easier.
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package config
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string `ocisConfig:"addr" env:"STORAGE_DEBUG_ADDR"`
|
||||
Token string `ocisConfig:"token" env:"STORAGE_DEBUG_TOKEN"`
|
||||
Pprof bool `ocisConfig:"pprof" env:"STORAGE_DEBUG_PPROF"`
|
||||
Zpages bool `ocisConfig:"zpages" env:"STORAGE_DEBUG_ZPAGES"`
|
||||
}
|
||||
@@ -1,443 +0,0 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
|
||||
)
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
// log is inherited
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9109",
|
||||
},
|
||||
Reva: Reva{
|
||||
JWTSecret: "Pive-Fumkiu4",
|
||||
SkipUserGroupsInToken: false,
|
||||
TransferSecret: "replace-me-with-a-transfer-secret",
|
||||
TransferExpires: 24 * 60 * 60,
|
||||
OIDC: OIDC{
|
||||
Issuer: "https://localhost:9200",
|
||||
Insecure: false,
|
||||
IDClaim: "preferred_username",
|
||||
},
|
||||
LDAP: LDAP{
|
||||
Hostname: "localhost",
|
||||
Port: 9126,
|
||||
CACert: path.Join(defaults.BaseDataPath(), "ldap", "ldap.crt"),
|
||||
Insecure: false,
|
||||
BaseDN: "dc=ocis,dc=test",
|
||||
LoginFilter: "(&(objectclass=posixAccount)(|(cn={{login}})(mail={{login}})))",
|
||||
UserFilter: "(&(objectclass=posixAccount)(|(ownclouduuid={{.OpaqueId}})(cn={{.OpaqueId}})))",
|
||||
UserAttributeFilter: "(&(objectclass=posixAccount)({{attr}}={{value}}))",
|
||||
UserFindFilter: "(&(objectclass=posixAccount)(|(cn={{query}}*)(displayname={{query}}*)(mail={{query}}*)))",
|
||||
UserGroupFilter: "(&(objectclass=posixGroup)(ownclouduuid={{.OpaqueId}}*))",
|
||||
GroupFilter: "(&(objectclass=posixGroup)(|(ownclouduuid={{.OpaqueId}})(cn={{.OpaqueId}})))",
|
||||
GroupAttributeFilter: "(&(objectclass=posixGroup)({{attr}}={{value}}))",
|
||||
GroupFindFilter: "(&(objectclass=posixGroup)(|(cn={{query}}*)(displayname={{query}}*)(mail={{query}}*)))",
|
||||
GroupMemberFilter: "(&(objectclass=posixAccount)(ownclouduuid={{.OpaqueId}}*))",
|
||||
BindDN: "cn=reva,ou=sysusers,dc=ocis,dc=test",
|
||||
BindPassword: "reva",
|
||||
IDP: "https://localhost:9200",
|
||||
UserSchema: LDAPUserSchema{
|
||||
UID: "ownclouduuid",
|
||||
Mail: "mail",
|
||||
DisplayName: "displayname",
|
||||
CN: "cn",
|
||||
UIDNumber: "uidnumber",
|
||||
GIDNumber: "gidnumber",
|
||||
},
|
||||
GroupSchema: LDAPGroupSchema{
|
||||
GID: "cn",
|
||||
Mail: "mail",
|
||||
DisplayName: "cn",
|
||||
CN: "cn",
|
||||
GIDNumber: "gidnumber",
|
||||
},
|
||||
},
|
||||
UserGroupRest: UserGroupRest{
|
||||
RedisAddress: "localhost:6379",
|
||||
},
|
||||
UserOwnCloudSQL: UserOwnCloudSQL{
|
||||
DBUsername: "owncloud",
|
||||
DBPassword: "secret",
|
||||
DBHost: "mysql",
|
||||
DBPort: 3306,
|
||||
DBName: "owncloud",
|
||||
Idp: "https://localhost:9200",
|
||||
Nobody: 90,
|
||||
JoinUsername: false,
|
||||
JoinOwnCloudUUID: false,
|
||||
EnableMedialSearch: false,
|
||||
},
|
||||
OCDav: OCDav{
|
||||
WebdavNamespace: "/home/",
|
||||
DavFilesNamespace: "/users/",
|
||||
},
|
||||
Archiver: Archiver{
|
||||
MaxNumFiles: 10000,
|
||||
MaxSize: 1073741824,
|
||||
ArchiverURL: "/archiver",
|
||||
},
|
||||
UserStorage: StorageConfig{
|
||||
EOS: DriverEOS{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: "/eos/dockertest/reva",
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{substr 0 1 .Username}}/{{.Username}}",
|
||||
},
|
||||
ShadowNamespace: "", // Defaults to path.Join(c.Namespace, ".shadow")
|
||||
UploadsNamespace: "", // Defaults to path.Join(c.Namespace, ".uploads")
|
||||
EosBinary: "/usr/bin/eos",
|
||||
XrdcopyBinary: "/usr/bin/xrdcopy",
|
||||
MasterURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
|
||||
SlaveURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
|
||||
CacheDirectory: os.TempDir(),
|
||||
GatewaySVC: "127.0.0.1:9142",
|
||||
},
|
||||
Local: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "local", "users"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Username}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
OwnCloud: DriverOwnCloud{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "owncloud"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
UploadInfoDir: path.Join(defaults.BaseDataPath(), "storage", "uploadinfo"),
|
||||
Redis: ":6379",
|
||||
Scan: true,
|
||||
},
|
||||
OwnCloudSQL: DriverOwnCloudSQL{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "owncloud"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Username}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
UploadInfoDir: path.Join(defaults.BaseDataPath(), "storage", "uploadinfo"),
|
||||
DBUsername: "owncloud",
|
||||
DBPassword: "owncloud",
|
||||
DBHost: "",
|
||||
DBPort: 3306,
|
||||
DBName: "owncloud",
|
||||
},
|
||||
S3: DriverS3{
|
||||
DriverCommon: DriverCommon{},
|
||||
Region: "default",
|
||||
AccessKey: "",
|
||||
SecretKey: "",
|
||||
Endpoint: "",
|
||||
Bucket: "",
|
||||
},
|
||||
S3NG: DriverS3NG{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "users"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
ServiceUserUUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
Region: "default",
|
||||
AccessKey: "",
|
||||
SecretKey: "",
|
||||
Endpoint: "",
|
||||
Bucket: "",
|
||||
},
|
||||
OCIS: DriverOCIS{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "users"),
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
},
|
||||
ServiceUserUUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
},
|
||||
},
|
||||
MetadataStorage: StorageConfig{
|
||||
EOS: DriverEOS{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: "/eos/dockertest/reva",
|
||||
ShareFolder: "/Shares",
|
||||
UserLayout: "{{substr 0 1 .Username}}/{{.Username}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
ShadowNamespace: "",
|
||||
UploadsNamespace: "",
|
||||
EosBinary: "/usr/bin/eos",
|
||||
XrdcopyBinary: "/usr/bin/xrdcopy",
|
||||
MasterURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
|
||||
GrpcURI: "",
|
||||
SlaveURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
|
||||
CacheDirectory: os.TempDir(),
|
||||
EnableLogging: false,
|
||||
ShowHiddenSysFiles: false,
|
||||
ForceSingleUserMode: false,
|
||||
UseKeytab: false,
|
||||
SecProtocol: "",
|
||||
Keytab: "",
|
||||
SingleUsername: "",
|
||||
GatewaySVC: "127.0.0.1:9142",
|
||||
},
|
||||
Local: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "local", "metadata"),
|
||||
},
|
||||
OwnCloud: DriverOwnCloud{},
|
||||
OwnCloudSQL: DriverOwnCloudSQL{},
|
||||
S3: DriverS3{
|
||||
DriverCommon: DriverCommon{},
|
||||
Region: "default",
|
||||
},
|
||||
S3NG: DriverS3NG{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "metadata"),
|
||||
ShareFolder: "",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
ServiceUserUUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
Region: "default",
|
||||
AccessKey: "",
|
||||
SecretKey: "",
|
||||
Endpoint: "",
|
||||
Bucket: "",
|
||||
},
|
||||
OCIS: DriverOCIS{
|
||||
DriverCommon: DriverCommon{
|
||||
Root: path.Join(defaults.BaseDataPath(), "storage", "metadata"),
|
||||
ShareFolder: "",
|
||||
UserLayout: "{{.Id.OpaqueId}}",
|
||||
EnableHome: false,
|
||||
},
|
||||
ServiceUserUUID: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
|
||||
},
|
||||
},
|
||||
Frontend: FrontendPort{
|
||||
Port: Port{
|
||||
MaxCPUs: "",
|
||||
LogLevel: "",
|
||||
GRPCNetwork: "",
|
||||
GRPCAddr: "",
|
||||
HTTPNetwork: "tcp",
|
||||
HTTPAddr: "127.0.0.1:9140",
|
||||
Protocol: "",
|
||||
Endpoint: "",
|
||||
DebugAddr: "127.0.0.1:9141",
|
||||
Services: []string{"datagateway", "ocdav", "ocs", "appprovider"},
|
||||
Config: nil,
|
||||
Context: nil,
|
||||
Supervised: false,
|
||||
},
|
||||
AppProviderInsecure: false,
|
||||
AppProviderPrefix: "",
|
||||
ArchiverInsecure: false,
|
||||
ArchiverPrefix: "archiver",
|
||||
DatagatewayPrefix: "data",
|
||||
Favorites: false,
|
||||
OCDavInsecure: false,
|
||||
OCDavPrefix: "",
|
||||
OCSPrefix: "ocs",
|
||||
OCSSharePrefix: "/Shares",
|
||||
OCSHomeNamespace: "/home",
|
||||
PublicURL: "https://localhost:9200",
|
||||
OCSCacheWarmupDriver: "",
|
||||
OCSAdditionalInfoAttribute: "{{.Mail}}",
|
||||
OCSResourceInfoCacheTTL: 0,
|
||||
Middleware: Middleware{},
|
||||
},
|
||||
DataGateway: DataGatewayPort{
|
||||
Port: Port{},
|
||||
PublicURL: "",
|
||||
},
|
||||
Gateway: Gateway{
|
||||
Port: Port{
|
||||
Endpoint: "127.0.0.1:9142",
|
||||
DebugAddr: "127.0.0.1:9143",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9142",
|
||||
},
|
||||
CommitShareToStorageGrant: true,
|
||||
CommitShareToStorageRef: true,
|
||||
DisableHomeCreationOnLogin: false,
|
||||
ShareFolder: "Shares",
|
||||
LinkGrants: "",
|
||||
HomeMapping: "",
|
||||
EtagCacheTTL: 0,
|
||||
},
|
||||
StorageRegistry: StorageRegistry{
|
||||
Driver: "static",
|
||||
HomeProvider: "/home",
|
||||
JSON: "",
|
||||
},
|
||||
AppRegistry: AppRegistry{
|
||||
Driver: "static",
|
||||
MimetypesJSON: "",
|
||||
},
|
||||
Users: Users{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9144",
|
||||
DebugAddr: "127.0.0.1:9145",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9144",
|
||||
Services: []string{"userprovider"},
|
||||
},
|
||||
Driver: "ldap",
|
||||
UserGroupsCacheExpiration: 5,
|
||||
},
|
||||
Groups: Groups{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9160",
|
||||
DebugAddr: "127.0.0.1:9161",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9160",
|
||||
Services: []string{"groupprovider"},
|
||||
},
|
||||
Driver: "ldap",
|
||||
GroupMembersCacheExpiration: 5,
|
||||
},
|
||||
AuthProvider: Users{
|
||||
Port: Port{},
|
||||
Driver: "ldap",
|
||||
UserGroupsCacheExpiration: 0,
|
||||
},
|
||||
AuthBasic: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9146",
|
||||
DebugAddr: "127.0.0.1:9147",
|
||||
Services: []string{"authprovider"},
|
||||
Endpoint: "localhost:9146",
|
||||
},
|
||||
AuthBearer: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9148",
|
||||
DebugAddr: "127.0.0.1:9149",
|
||||
Services: []string{"authprovider"},
|
||||
Endpoint: "localhost:9148",
|
||||
},
|
||||
AuthMachine: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9166",
|
||||
DebugAddr: "127.0.0.1:9167",
|
||||
Services: []string{"authprovider"},
|
||||
Endpoint: "localhost:9166",
|
||||
},
|
||||
AuthMachineConfig: AuthMachineConfig{
|
||||
MachineAuthAPIKey: "change-me-please",
|
||||
},
|
||||
Sharing: Sharing{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9150",
|
||||
DebugAddr: "127.0.0.1:9151",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9150",
|
||||
Services: []string{"usershareprovider", "publicshareprovider"},
|
||||
},
|
||||
UserDriver: "json",
|
||||
UserJSONFile: path.Join(defaults.BaseDataPath(), "storage", "shares.json"),
|
||||
UserSQLUsername: "",
|
||||
UserSQLPassword: "",
|
||||
UserSQLHost: "",
|
||||
UserSQLPort: 1433,
|
||||
UserSQLName: "",
|
||||
PublicDriver: "json",
|
||||
PublicJSONFile: path.Join(defaults.BaseDataPath(), "storage", "publicshares.json"),
|
||||
PublicPasswordHashCost: 11,
|
||||
PublicEnableExpiredSharesCleanup: true,
|
||||
PublicJanitorRunInterval: 60,
|
||||
UserStorageMountID: "",
|
||||
},
|
||||
StorageHome: StoragePort{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9154",
|
||||
DebugAddr: "127.0.0.1:9156",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9154",
|
||||
HTTPNetwork: "tcp",
|
||||
HTTPAddr: "127.0.0.1:9155",
|
||||
},
|
||||
Driver: "ocis",
|
||||
ReadOnly: false,
|
||||
MountPath: "/home",
|
||||
AlternativeID: "1284d238-aa92-42ce-bdc4-0b0000009154",
|
||||
MountID: "1284d238-aa92-42ce-bdc4-0b0000009157",
|
||||
DataServerURL: "http://localhost:9155/data",
|
||||
HTTPPrefix: "data",
|
||||
TempFolder: path.Join(defaults.BaseDataPath(), "tmp", "home"),
|
||||
},
|
||||
StorageUsers: StoragePort{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9157",
|
||||
DebugAddr: "127.0.0.1:9159",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9157",
|
||||
HTTPNetwork: "tcp",
|
||||
HTTPAddr: "127.0.0.1:9158",
|
||||
},
|
||||
MountPath: "/users",
|
||||
MountID: "1284d238-aa92-42ce-bdc4-0b0000009157",
|
||||
Driver: "ocis",
|
||||
DataServerURL: "http://localhost:9158/data",
|
||||
HTTPPrefix: "data",
|
||||
TempFolder: path.Join(defaults.BaseDataPath(), "tmp", "users"),
|
||||
},
|
||||
StoragePublicLink: PublicStorage{
|
||||
StoragePort: StoragePort{
|
||||
Port: Port{
|
||||
Endpoint: "localhost:9178",
|
||||
DebugAddr: "127.0.0.1:9179",
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9178",
|
||||
},
|
||||
MountPath: "/public",
|
||||
MountID: "e1a73ede-549b-4226-abdf-40e69ca8230d",
|
||||
},
|
||||
PublicShareProviderAddr: "",
|
||||
UserProviderAddr: "",
|
||||
},
|
||||
StorageMetadata: StoragePort{
|
||||
Port: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9215",
|
||||
HTTPNetwork: "tcp",
|
||||
HTTPAddr: "127.0.0.1:9216",
|
||||
DebugAddr: "127.0.0.1:9217",
|
||||
},
|
||||
Driver: "ocis",
|
||||
ExposeDataServer: false,
|
||||
DataServerURL: "http://localhost:9216/data",
|
||||
TempFolder: path.Join(defaults.BaseDataPath(), "tmp", "metadata"),
|
||||
DataProvider: DataProvider{},
|
||||
},
|
||||
AppProvider: AppProvider{
|
||||
Port: Port{
|
||||
GRPCNetwork: "tcp",
|
||||
GRPCAddr: "127.0.0.1:9164",
|
||||
DebugAddr: "127.0.0.1:9165",
|
||||
Endpoint: "localhost:9164",
|
||||
Services: []string{"appprovider"},
|
||||
},
|
||||
ExternalAddr: "127.0.0.1:9164",
|
||||
WopiDriver: WopiDriver{},
|
||||
AppsURL: "/app/list",
|
||||
OpenURL: "/app/open",
|
||||
NewURL: "/app/new",
|
||||
},
|
||||
Configs: nil,
|
||||
UploadMaxChunkSize: 1e+8,
|
||||
UploadHTTPMethodOverride: "",
|
||||
ChecksumSupportedTypes: []string{"sha1", "md5", "adler32"},
|
||||
ChecksumPreferredUploadType: "",
|
||||
DefaultUploadProtocol: "tus",
|
||||
},
|
||||
Tracing: Tracing{
|
||||
Service: "storage",
|
||||
Type: "jaeger",
|
||||
},
|
||||
Asset: Asset{},
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package config
|
||||
|
||||
// GRPC defines the available grpc configuration.
|
||||
type GRPC struct {
|
||||
Addr string `ocisConfig:"addr" env:"SETTINGS_GRPC_ADDR"`
|
||||
Namespace string
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package config
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string `ocisConfig:"addr" env:"SETTINGS_HTTP_ADDR"`
|
||||
Namespace string
|
||||
Root string `ocisConfig:"root" env:"SETTINGS_HTTP_ROOT"`
|
||||
CacheTTL int `ocisConfig:"cache_ttl" env:"SETTINGS_CACHE_TTL"`
|
||||
CORS CORS `ocisConfig:"cors"`
|
||||
}
|
||||
|
||||
// CORS defines the available cors configuration.
|
||||
type CORS struct {
|
||||
AllowedOrigins []string `ocisConfig:"allowed_origins"`
|
||||
AllowedMethods []string `ocisConfig:"allowed_methods"`
|
||||
AllowedHeaders []string `ocisConfig:"allowed_headers"`
|
||||
AllowCredentials bool `ocisConfig:"allowed_credentials"`
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package config
|
||||
|
||||
// Log defines the available log configuration.
|
||||
type Log struct {
|
||||
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;STORAGE_LOG_LEVEL"`
|
||||
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;STORAGE_LOG_PRETTY"`
|
||||
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;STORAGE_LOG_COLOR"`
|
||||
File string `mapstructure:"file" env:"OCIS_LOG_FILE;STORAGE_LOG_FILE"`
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package config
|
||||
|
||||
// TokenManager is the config for using the reva token manager
|
||||
type TokenManager struct {
|
||||
JWTSecret string `ocisConfig:"jwt_secret" env:"OCIS_JWT_SECRET;SETTINGS_JWT_SECRET"`
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package config
|
||||
|
||||
// Service defines the available service configuration.
|
||||
type Service struct {
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package config
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;STORAGE_TRACING_ENABLED"`
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;STORAGE_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;STORAGE_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;STORAGE_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"STORAGE_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package logging
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/storage/pkg/config"
|
||||
)
|
||||
|
||||
// LoggerFromConfig initializes a service-specific logger instance.
|
||||
func Configure(name string, cfg config.Log) log.Logger {
|
||||
return log.NewLogger(
|
||||
log.Name(name),
|
||||
log.Level(cfg.Level),
|
||||
log.Pretty(cfg.Pretty),
|
||||
log.Color(cfg.Color),
|
||||
log.File(cfg.File),
|
||||
)
|
||||
}
|
||||
@@ -60,17 +60,17 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
//if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
// cfg.Log = &shared.Log{
|
||||
// Level: cfg.Commons.Log.Level,
|
||||
// Pretty: cfg.Commons.Log.Pretty,
|
||||
// Color: cfg.Commons.Log.Color,
|
||||
// File: cfg.Commons.Log.File,
|
||||
// }
|
||||
//} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
// cfg.Log = &shared.Log{}
|
||||
//}
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Log = &config.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
Pretty: cfg.Commons.Log.Pretty,
|
||||
Color: cfg.Commons.Log.Color,
|
||||
File: cfg.Commons.Log.File,
|
||||
}
|
||||
} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
cfg.Log = &config.Log{}
|
||||
}
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
envCfg := config.Config{}
|
||||
|
||||
@@ -2,14 +2,18 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Service Service
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Log *Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
GRPC GRPC `ocisConfig:"grpc"`
|
||||
|
||||
@@ -26,7 +26,6 @@ func DefaultConfig() *Config {
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "store",
|
||||
},
|
||||
Datapath: path.Join(defaults.BaseDataPath(), "store"),
|
||||
}
|
||||
|
||||
@@ -6,5 +6,4 @@ type Tracing struct {
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;STORE_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;STORE_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;STORE_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"STORE_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
// LoggerFromConfig initializes a service-specific logger instance.
|
||||
func Configure(name string, cfg config.Log) log.Logger {
|
||||
func Configure(name string, cfg *config.Log) log.Logger {
|
||||
return log.NewLogger(
|
||||
log.Name(name),
|
||||
log.Level(cfg.Level),
|
||||
|
||||
@@ -14,7 +14,7 @@ var (
|
||||
func Configure(cfg *config.Config) error {
|
||||
var err error
|
||||
if cfg.Tracing.Enabled {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, "store", cfg.Tracing.Type); err != nil {
|
||||
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Endpoint, cfg.Tracing.Collector, cfg.Service.Name, cfg.Tracing.Type); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,16 +61,16 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
}
|
||||
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
//if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
// cfg.Log = &shared.Log{
|
||||
// Level: cfg.Commons.Log.Level,
|
||||
// Pretty: cfg.Commons.Log.Pretty,
|
||||
// Color: cfg.Commons.Log.Color,
|
||||
// File: cfg.Commons.Log.File,
|
||||
// }
|
||||
//} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
// cfg.Log = &shared.Log{}
|
||||
//}
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
cfg.Log = &config.Log{
|
||||
Level: cfg.Commons.Log.Level,
|
||||
Pretty: cfg.Commons.Log.Pretty,
|
||||
Color: cfg.Commons.Log.Color,
|
||||
File: cfg.Commons.Log.File,
|
||||
}
|
||||
} else if cfg.Log == nil && cfg.Commons == nil {
|
||||
cfg.Log = &config.Log{}
|
||||
}
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
envCfg := config.Config{}
|
||||
@@ -93,7 +93,7 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new thumbnails.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
//cfg.Thumbnails.Commons = cfg.Commons
|
||||
cfg.Thumbnails.Commons = cfg.Commons
|
||||
return SutureService{
|
||||
cfg: cfg.Thumbnails,
|
||||
}
|
||||
|
||||
@@ -2,14 +2,18 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
)
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Service Service
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Log *Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
GRPC GRPC `ocisConfig:"grpc"`
|
||||
|
||||
@@ -26,7 +26,6 @@ func DefaultConfig() *Config {
|
||||
Type: "jaeger",
|
||||
Endpoint: "",
|
||||
Collector: "",
|
||||
Service: "thumbnails",
|
||||
},
|
||||
Thumbnail: Thumbnail{
|
||||
Resolutions: []string{"16x16", "32x32", "64x64", "128x128", "1920x1080", "3840x2160", "7680x4320"},
|
||||
|
||||
@@ -6,5 +6,4 @@ type Tracing struct {
|
||||
Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;THUMBNAILS_TRACING_TYPE"`
|
||||
Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;THUMBNAILS_TRACING_ENDPOINT"`
|
||||
Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;THUMBNAILS_TRACING_COLLECTOR"`
|
||||
Service string `ocisConfig:"service" env:"THUMBNAILS_TRACING_SERVICE"` //TODO: should this be an ID? or the same as Service.Name?
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user