diff --git a/extensions/appprovider/pkg/command/command.go b/extensions/appprovider/pkg/command/command.go index f638e3c98c..e2cbfd42c2 100644 --- a/extensions/appprovider/pkg/command/command.go +++ b/extensions/appprovider/pkg/command/command.go @@ -12,7 +12,7 @@ import ( "github.com/oklog/run" "github.com/owncloud/ocis/extensions/appprovider/pkg/config" "github.com/owncloud/ocis/extensions/appprovider/pkg/config/parser" - "github.com/owncloud/ocis/extensions/storage/pkg/server/debug" + "github.com/owncloud/ocis/extensions/appprovider/pkg/server/debug" ociscfg "github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/log" "github.com/owncloud/ocis/ocis-pkg/sync" @@ -63,13 +63,9 @@ func AppProvider(cfg *config.Config) *cli.Command { }) debugServer, err := debug.Server( - debug.Name(c.Command.Name+"-debug"), - debug.Addr(cfg.Debug.Addr), debug.Logger(logger), debug.Context(ctx), - debug.Pprof(cfg.Debug.Pprof), - debug.Zpages(cfg.Debug.Zpages), - debug.Token(cfg.Debug.Token), + debug.Config(cfg), ) if err != nil { diff --git a/extensions/appprovider/pkg/server/debug/option.go b/extensions/appprovider/pkg/server/debug/option.go new file mode 100644 index 0000000000..d072eb56e8 --- /dev/null +++ b/extensions/appprovider/pkg/server/debug/option.go @@ -0,0 +1,50 @@ +package debug + +import ( + "context" + + "github.com/owncloud/ocis/extensions/appprovider/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/log" +) + +// Option defines a single option function. +type Option func(o *Options) + +// Options defines the available options for this package. +type Options struct { + Logger log.Logger + Context context.Context + Config *config.Config +} + +// newOptions initializes the available default options. +func newOptions(opts ...Option) Options { + opt := Options{} + + for _, o := range opts { + o(&opt) + } + + return opt +} + +// Logger provides a function to set the logger option. +func Logger(val log.Logger) Option { + return func(o *Options) { + o.Logger = val + } +} + +// Context provides a function to set the context option. +func Context(val context.Context) Option { + return func(o *Options) { + o.Context = val + } +} + +// Config provides a function to set the config option. +func Config(val *config.Config) Option { + return func(o *Options) { + o.Config = val + } +} diff --git a/extensions/appprovider/pkg/server/debug/server.go b/extensions/appprovider/pkg/server/debug/server.go new file mode 100644 index 0000000000..e2ef65074a --- /dev/null +++ b/extensions/appprovider/pkg/server/debug/server.go @@ -0,0 +1,63 @@ +package debug + +import ( + "io" + "net/http" + + "github.com/owncloud/ocis/extensions/appprovider/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/service/debug" + "github.com/owncloud/ocis/ocis-pkg/version" +) + +// Server initializes the debug service and server. +func Server(opts ...Option) (*http.Server, error) { + options := newOptions(opts...) + + return debug.NewService( + debug.Logger(options.Logger), + debug.Name(options.Config.Service.Name), + debug.Version(version.String), + debug.Address(options.Config.Debug.Addr), + debug.Token(options.Config.Debug.Token), + debug.Pprof(options.Config.Debug.Pprof), + debug.Zpages(options.Config.Debug.Zpages), + debug.Health(health(options.Config)), + debug.Ready(ready(options.Config)), + //debug.CorsAllowedOrigins(options.Config.HTTP.CORS.AllowedOrigins), + //debug.CorsAllowedMethods(options.Config.HTTP.CORS.AllowedMethods), + //debug.CorsAllowedHeaders(options.Config.HTTP.CORS.AllowedHeaders), + //debug.CorsAllowCredentials(options.Config.HTTP.CORS.AllowCredentials), + ), nil +} + +// health implements the health check. +func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} + +// ready implements the ready check. +func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} diff --git a/extensions/auth-basic/pkg/command/command.go b/extensions/auth-basic/pkg/command/command.go index cd08691a56..ce77c11685 100644 --- a/extensions/auth-basic/pkg/command/command.go +++ b/extensions/auth-basic/pkg/command/command.go @@ -13,7 +13,7 @@ import ( "github.com/oklog/run" "github.com/owncloud/ocis/extensions/auth-basic/pkg/config" "github.com/owncloud/ocis/extensions/auth-basic/pkg/config/parser" - "github.com/owncloud/ocis/extensions/storage/pkg/server/debug" + "github.com/owncloud/ocis/extensions/auth-basic/pkg/server/debug" ociscfg "github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/ldap" "github.com/owncloud/ocis/ocis-pkg/log" @@ -85,13 +85,9 @@ func AuthBasic(cfg *config.Config) *cli.Command { }) debugServer, err := debug.Server( - debug.Name(c.Command.Name+"-debug"), - debug.Addr(cfg.Debug.Addr), debug.Logger(logger), debug.Context(ctx), - debug.Pprof(cfg.Debug.Pprof), - debug.Zpages(cfg.Debug.Zpages), - debug.Token(cfg.Debug.Token), + debug.Config(cfg), ) if err != nil { diff --git a/extensions/auth-basic/pkg/server/debug/option.go b/extensions/auth-basic/pkg/server/debug/option.go new file mode 100644 index 0000000000..ed1658963c --- /dev/null +++ b/extensions/auth-basic/pkg/server/debug/option.go @@ -0,0 +1,50 @@ +package debug + +import ( + "context" + + "github.com/owncloud/ocis/extensions/auth-basic/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/log" +) + +// Option defines a single option function. +type Option func(o *Options) + +// Options defines the available options for this package. +type Options struct { + Logger log.Logger + Context context.Context + Config *config.Config +} + +// newOptions initializes the available default options. +func newOptions(opts ...Option) Options { + opt := Options{} + + for _, o := range opts { + o(&opt) + } + + return opt +} + +// Logger provides a function to set the logger option. +func Logger(val log.Logger) Option { + return func(o *Options) { + o.Logger = val + } +} + +// Context provides a function to set the context option. +func Context(val context.Context) Option { + return func(o *Options) { + o.Context = val + } +} + +// Config provides a function to set the config option. +func Config(val *config.Config) Option { + return func(o *Options) { + o.Config = val + } +} diff --git a/extensions/auth-basic/pkg/server/debug/server.go b/extensions/auth-basic/pkg/server/debug/server.go new file mode 100644 index 0000000000..e6f813ac97 --- /dev/null +++ b/extensions/auth-basic/pkg/server/debug/server.go @@ -0,0 +1,63 @@ +package debug + +import ( + "io" + "net/http" + + "github.com/owncloud/ocis/extensions/auth-basic/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/service/debug" + "github.com/owncloud/ocis/ocis-pkg/version" +) + +// Server initializes the debug service and server. +func Server(opts ...Option) (*http.Server, error) { + options := newOptions(opts...) + + return debug.NewService( + debug.Logger(options.Logger), + debug.Name(options.Config.Service.Name), + debug.Version(version.String), + debug.Address(options.Config.Debug.Addr), + debug.Token(options.Config.Debug.Token), + debug.Pprof(options.Config.Debug.Pprof), + debug.Zpages(options.Config.Debug.Zpages), + debug.Health(health(options.Config)), + debug.Ready(ready(options.Config)), + //debug.CorsAllowedOrigins(options.Config.HTTP.CORS.AllowedOrigins), + //debug.CorsAllowedMethods(options.Config.HTTP.CORS.AllowedMethods), + //debug.CorsAllowedHeaders(options.Config.HTTP.CORS.AllowedHeaders), + //debug.CorsAllowCredentials(options.Config.HTTP.CORS.AllowCredentials), + ), nil +} + +// health implements the health check. +func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} + +// ready implements the ready check. +func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} diff --git a/extensions/auth-bearer/pkg/command/command.go b/extensions/auth-bearer/pkg/command/command.go index ea41172d27..4274fb4e7f 100644 --- a/extensions/auth-bearer/pkg/command/command.go +++ b/extensions/auth-bearer/pkg/command/command.go @@ -12,7 +12,7 @@ import ( "github.com/oklog/run" "github.com/owncloud/ocis/extensions/auth-bearer/pkg/config" "github.com/owncloud/ocis/extensions/auth-bearer/pkg/config/parser" - "github.com/owncloud/ocis/extensions/storage/pkg/server/debug" + "github.com/owncloud/ocis/extensions/auth-bearer/pkg/server/debug" ociscfg "github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/log" "github.com/owncloud/ocis/ocis-pkg/sync" @@ -66,13 +66,9 @@ func AuthBearer(cfg *config.Config) *cli.Command { }) debugServer, err := debug.Server( - debug.Name(c.Command.Name+"-debug"), - debug.Addr(cfg.Debug.Addr), debug.Logger(logger), debug.Context(ctx), - debug.Pprof(cfg.Debug.Pprof), - debug.Zpages(cfg.Debug.Zpages), - debug.Token(cfg.Debug.Token), + debug.Config(cfg), ) if err != nil { diff --git a/extensions/auth-bearer/pkg/server/debug/option.go b/extensions/auth-bearer/pkg/server/debug/option.go new file mode 100644 index 0000000000..8ed17ad269 --- /dev/null +++ b/extensions/auth-bearer/pkg/server/debug/option.go @@ -0,0 +1,50 @@ +package debug + +import ( + "context" + + "github.com/owncloud/ocis/extensions/auth-bearer/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/log" +) + +// Option defines a single option function. +type Option func(o *Options) + +// Options defines the available options for this package. +type Options struct { + Logger log.Logger + Context context.Context + Config *config.Config +} + +// newOptions initializes the available default options. +func newOptions(opts ...Option) Options { + opt := Options{} + + for _, o := range opts { + o(&opt) + } + + return opt +} + +// Logger provides a function to set the logger option. +func Logger(val log.Logger) Option { + return func(o *Options) { + o.Logger = val + } +} + +// Context provides a function to set the context option. +func Context(val context.Context) Option { + return func(o *Options) { + o.Context = val + } +} + +// Config provides a function to set the config option. +func Config(val *config.Config) Option { + return func(o *Options) { + o.Config = val + } +} diff --git a/extensions/auth-bearer/pkg/server/debug/server.go b/extensions/auth-bearer/pkg/server/debug/server.go new file mode 100644 index 0000000000..f125a12870 --- /dev/null +++ b/extensions/auth-bearer/pkg/server/debug/server.go @@ -0,0 +1,63 @@ +package debug + +import ( + "io" + "net/http" + + "github.com/owncloud/ocis/extensions/auth-bearer/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/service/debug" + "github.com/owncloud/ocis/ocis-pkg/version" +) + +// Server initializes the debug service and server. +func Server(opts ...Option) (*http.Server, error) { + options := newOptions(opts...) + + return debug.NewService( + debug.Logger(options.Logger), + debug.Name(options.Config.Service.Name), + debug.Version(version.String), + debug.Address(options.Config.Debug.Addr), + debug.Token(options.Config.Debug.Token), + debug.Pprof(options.Config.Debug.Pprof), + debug.Zpages(options.Config.Debug.Zpages), + debug.Health(health(options.Config)), + debug.Ready(ready(options.Config)), + //debug.CorsAllowedOrigins(options.Config.HTTP.CORS.AllowedOrigins), + //debug.CorsAllowedMethods(options.Config.HTTP.CORS.AllowedMethods), + //debug.CorsAllowedHeaders(options.Config.HTTP.CORS.AllowedHeaders), + //debug.CorsAllowCredentials(options.Config.HTTP.CORS.AllowCredentials), + ), nil +} + +// health implements the health check. +func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} + +// ready implements the ready check. +func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} diff --git a/extensions/auth-machine/pkg/command/command.go b/extensions/auth-machine/pkg/command/command.go index 1ab91220af..674c7b220f 100644 --- a/extensions/auth-machine/pkg/command/command.go +++ b/extensions/auth-machine/pkg/command/command.go @@ -12,7 +12,7 @@ import ( "github.com/oklog/run" "github.com/owncloud/ocis/extensions/auth-machine/pkg/config" "github.com/owncloud/ocis/extensions/auth-machine/pkg/config/parser" - "github.com/owncloud/ocis/extensions/storage/pkg/server/debug" + "github.com/owncloud/ocis/extensions/auth-machine/pkg/server/debug" ociscfg "github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/log" "github.com/owncloud/ocis/ocis-pkg/sync" @@ -66,13 +66,9 @@ func AuthMachine(cfg *config.Config) *cli.Command { }) debugServer, err := debug.Server( - debug.Name(c.Command.Name+"-debug"), - debug.Addr(cfg.Debug.Addr), debug.Logger(logger), debug.Context(ctx), - debug.Pprof(cfg.Debug.Pprof), - debug.Zpages(cfg.Debug.Zpages), - debug.Token(cfg.Debug.Token), + debug.Config(cfg), ) if err != nil { diff --git a/extensions/auth-machine/pkg/server/debug/option.go b/extensions/auth-machine/pkg/server/debug/option.go new file mode 100644 index 0000000000..5666e1b3cc --- /dev/null +++ b/extensions/auth-machine/pkg/server/debug/option.go @@ -0,0 +1,50 @@ +package debug + +import ( + "context" + + "github.com/owncloud/ocis/extensions/auth-machine/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/log" +) + +// Option defines a single option function. +type Option func(o *Options) + +// Options defines the available options for this package. +type Options struct { + Logger log.Logger + Context context.Context + Config *config.Config +} + +// newOptions initializes the available default options. +func newOptions(opts ...Option) Options { + opt := Options{} + + for _, o := range opts { + o(&opt) + } + + return opt +} + +// Logger provides a function to set the logger option. +func Logger(val log.Logger) Option { + return func(o *Options) { + o.Logger = val + } +} + +// Context provides a function to set the context option. +func Context(val context.Context) Option { + return func(o *Options) { + o.Context = val + } +} + +// Config provides a function to set the config option. +func Config(val *config.Config) Option { + return func(o *Options) { + o.Config = val + } +} diff --git a/extensions/auth-machine/pkg/server/debug/server.go b/extensions/auth-machine/pkg/server/debug/server.go new file mode 100644 index 0000000000..b523773ce9 --- /dev/null +++ b/extensions/auth-machine/pkg/server/debug/server.go @@ -0,0 +1,63 @@ +package debug + +import ( + "io" + "net/http" + + "github.com/owncloud/ocis/extensions/auth-machine/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/service/debug" + "github.com/owncloud/ocis/ocis-pkg/version" +) + +// Server initializes the debug service and server. +func Server(opts ...Option) (*http.Server, error) { + options := newOptions(opts...) + + return debug.NewService( + debug.Logger(options.Logger), + debug.Name(options.Config.Service.Name), + debug.Version(version.String), + debug.Address(options.Config.Debug.Addr), + debug.Token(options.Config.Debug.Token), + debug.Pprof(options.Config.Debug.Pprof), + debug.Zpages(options.Config.Debug.Zpages), + debug.Health(health(options.Config)), + debug.Ready(ready(options.Config)), + //debug.CorsAllowedOrigins(options.Config.HTTP.CORS.AllowedOrigins), + //debug.CorsAllowedMethods(options.Config.HTTP.CORS.AllowedMethods), + //debug.CorsAllowedHeaders(options.Config.HTTP.CORS.AllowedHeaders), + //debug.CorsAllowCredentials(options.Config.HTTP.CORS.AllowCredentials), + ), nil +} + +// health implements the health check. +func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} + +// ready implements the ready check. +func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} diff --git a/extensions/frontend/pkg/command/command.go b/extensions/frontend/pkg/command/command.go index d14917d1c6..ff2d2e636c 100644 --- a/extensions/frontend/pkg/command/command.go +++ b/extensions/frontend/pkg/command/command.go @@ -13,7 +13,7 @@ import ( "github.com/oklog/run" "github.com/owncloud/ocis/extensions/frontend/pkg/config" "github.com/owncloud/ocis/extensions/frontend/pkg/config/parser" - "github.com/owncloud/ocis/extensions/storage/pkg/server/debug" + "github.com/owncloud/ocis/extensions/frontend/pkg/server/debug" ociscfg "github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/log" "github.com/owncloud/ocis/ocis-pkg/sync" @@ -107,13 +107,9 @@ func Frontend(cfg *config.Config) *cli.Command { { server, err := debug.Server( - debug.Name(c.Command.Name+"-debug"), - debug.Addr(cfg.Debug.Addr), debug.Logger(logger), debug.Context(ctx), - debug.Pprof(cfg.Debug.Pprof), - debug.Zpages(cfg.Debug.Zpages), - debug.Token(cfg.Debug.Token), + debug.Config(cfg), ) if err != nil { diff --git a/extensions/frontend/pkg/server/debug/option.go b/extensions/frontend/pkg/server/debug/option.go new file mode 100644 index 0000000000..a46ead603a --- /dev/null +++ b/extensions/frontend/pkg/server/debug/option.go @@ -0,0 +1,50 @@ +package debug + +import ( + "context" + + "github.com/owncloud/ocis/extensions/frontend/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/log" +) + +// Option defines a single option function. +type Option func(o *Options) + +// Options defines the available options for this package. +type Options struct { + Logger log.Logger + Context context.Context + Config *config.Config +} + +// newOptions initializes the available default options. +func newOptions(opts ...Option) Options { + opt := Options{} + + for _, o := range opts { + o(&opt) + } + + return opt +} + +// Logger provides a function to set the logger option. +func Logger(val log.Logger) Option { + return func(o *Options) { + o.Logger = val + } +} + +// Context provides a function to set the context option. +func Context(val context.Context) Option { + return func(o *Options) { + o.Context = val + } +} + +// Config provides a function to set the config option. +func Config(val *config.Config) Option { + return func(o *Options) { + o.Config = val + } +} diff --git a/extensions/frontend/pkg/server/debug/server.go b/extensions/frontend/pkg/server/debug/server.go new file mode 100644 index 0000000000..202c9c3058 --- /dev/null +++ b/extensions/frontend/pkg/server/debug/server.go @@ -0,0 +1,63 @@ +package debug + +import ( + "io" + "net/http" + + "github.com/owncloud/ocis/extensions/frontend/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/service/debug" + "github.com/owncloud/ocis/ocis-pkg/version" +) + +// Server initializes the debug service and server. +func Server(opts ...Option) (*http.Server, error) { + options := newOptions(opts...) + + return debug.NewService( + debug.Logger(options.Logger), + debug.Name(options.Config.Service.Name), + debug.Version(version.String), + debug.Address(options.Config.Debug.Addr), + debug.Token(options.Config.Debug.Token), + debug.Pprof(options.Config.Debug.Pprof), + debug.Zpages(options.Config.Debug.Zpages), + debug.Health(health(options.Config)), + debug.Ready(ready(options.Config)), + //debug.CorsAllowedOrigins(options.Config.HTTP.CORS.AllowedOrigins), + //debug.CorsAllowedMethods(options.Config.HTTP.CORS.AllowedMethods), + //debug.CorsAllowedHeaders(options.Config.HTTP.CORS.AllowedHeaders), + //debug.CorsAllowCredentials(options.Config.HTTP.CORS.AllowCredentials), + ), nil +} + +// health implements the health check. +func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} + +// ready implements the ready check. +func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} diff --git a/extensions/gateway/pkg/command/command.go b/extensions/gateway/pkg/command/command.go index 60440c2279..262f818858 100644 --- a/extensions/gateway/pkg/command/command.go +++ b/extensions/gateway/pkg/command/command.go @@ -17,10 +17,10 @@ import ( "github.com/oklog/run" "github.com/owncloud/ocis/extensions/gateway/pkg/config" "github.com/owncloud/ocis/extensions/gateway/pkg/config/parser" - "github.com/owncloud/ocis/extensions/storage/pkg/server/debug" - "github.com/owncloud/ocis/extensions/storage/pkg/service/external" + "github.com/owncloud/ocis/extensions/gateway/pkg/server/debug" ociscfg "github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/log" + "github.com/owncloud/ocis/ocis-pkg/service/external" "github.com/owncloud/ocis/ocis-pkg/sync" "github.com/owncloud/ocis/ocis-pkg/tracing" "github.com/owncloud/ocis/ocis-pkg/version" @@ -90,13 +90,9 @@ func Gateway(cfg *config.Config) *cli.Command { }) debugServer, err := debug.Server( - debug.Name(c.Command.Name+"-debug"), - debug.Addr(cfg.Debug.Addr), debug.Logger(logger), debug.Context(ctx), - debug.Pprof(cfg.Debug.Pprof), - debug.Zpages(cfg.Debug.Zpages), - debug.Token(cfg.Debug.Token), + debug.Config(cfg), ) if err != nil { diff --git a/extensions/gateway/pkg/server/debug/option.go b/extensions/gateway/pkg/server/debug/option.go new file mode 100644 index 0000000000..9bdf55de12 --- /dev/null +++ b/extensions/gateway/pkg/server/debug/option.go @@ -0,0 +1,50 @@ +package debug + +import ( + "context" + + "github.com/owncloud/ocis/extensions/gateway/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/log" +) + +// Option defines a single option function. +type Option func(o *Options) + +// Options defines the available options for this package. +type Options struct { + Logger log.Logger + Context context.Context + Config *config.Config +} + +// newOptions initializes the available default options. +func newOptions(opts ...Option) Options { + opt := Options{} + + for _, o := range opts { + o(&opt) + } + + return opt +} + +// Logger provides a function to set the logger option. +func Logger(val log.Logger) Option { + return func(o *Options) { + o.Logger = val + } +} + +// Context provides a function to set the context option. +func Context(val context.Context) Option { + return func(o *Options) { + o.Context = val + } +} + +// Config provides a function to set the config option. +func Config(val *config.Config) Option { + return func(o *Options) { + o.Config = val + } +} diff --git a/extensions/gateway/pkg/server/debug/server.go b/extensions/gateway/pkg/server/debug/server.go new file mode 100644 index 0000000000..a1470d904c --- /dev/null +++ b/extensions/gateway/pkg/server/debug/server.go @@ -0,0 +1,63 @@ +package debug + +import ( + "io" + "net/http" + + "github.com/owncloud/ocis/extensions/gateway/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/service/debug" + "github.com/owncloud/ocis/ocis-pkg/version" +) + +// Server initializes the debug service and server. +func Server(opts ...Option) (*http.Server, error) { + options := newOptions(opts...) + + return debug.NewService( + debug.Logger(options.Logger), + debug.Name(options.Config.Service.Name), + debug.Version(version.String), + debug.Address(options.Config.Debug.Addr), + debug.Token(options.Config.Debug.Token), + debug.Pprof(options.Config.Debug.Pprof), + debug.Zpages(options.Config.Debug.Zpages), + debug.Health(health(options.Config)), + debug.Ready(ready(options.Config)), + //debug.CorsAllowedOrigins(options.Config.HTTP.CORS.AllowedOrigins), + //debug.CorsAllowedMethods(options.Config.HTTP.CORS.AllowedMethods), + //debug.CorsAllowedHeaders(options.Config.HTTP.CORS.AllowedHeaders), + //debug.CorsAllowCredentials(options.Config.HTTP.CORS.AllowCredentials), + ), nil +} + +// health implements the health check. +func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} + +// ready implements the ready check. +func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} diff --git a/extensions/group/pkg/command/command.go b/extensions/group/pkg/command/command.go index 9f5d45dfe6..f1f7da429c 100644 --- a/extensions/group/pkg/command/command.go +++ b/extensions/group/pkg/command/command.go @@ -13,7 +13,7 @@ import ( "github.com/oklog/run" "github.com/owncloud/ocis/extensions/group/pkg/config" "github.com/owncloud/ocis/extensions/group/pkg/config/parser" - "github.com/owncloud/ocis/extensions/storage/pkg/server/debug" + "github.com/owncloud/ocis/extensions/group/pkg/server/debug" ociscfg "github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/ldap" "github.com/owncloud/ocis/ocis-pkg/log" @@ -83,13 +83,9 @@ func Groups(cfg *config.Config) *cli.Command { }) debugServer, err := debug.Server( - debug.Name(c.Command.Name+"-debug"), - debug.Addr(cfg.Debug.Addr), debug.Logger(logger), debug.Context(ctx), - debug.Pprof(cfg.Debug.Pprof), - debug.Zpages(cfg.Debug.Zpages), - debug.Token(cfg.Debug.Token), + debug.Config(cfg), ) if err != nil { diff --git a/extensions/group/pkg/server/debug/option.go b/extensions/group/pkg/server/debug/option.go new file mode 100644 index 0000000000..6b1c347dd4 --- /dev/null +++ b/extensions/group/pkg/server/debug/option.go @@ -0,0 +1,50 @@ +package debug + +import ( + "context" + + "github.com/owncloud/ocis/extensions/group/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/log" +) + +// Option defines a single option function. +type Option func(o *Options) + +// Options defines the available options for this package. +type Options struct { + Logger log.Logger + Context context.Context + Config *config.Config +} + +// newOptions initializes the available default options. +func newOptions(opts ...Option) Options { + opt := Options{} + + for _, o := range opts { + o(&opt) + } + + return opt +} + +// Logger provides a function to set the logger option. +func Logger(val log.Logger) Option { + return func(o *Options) { + o.Logger = val + } +} + +// Context provides a function to set the context option. +func Context(val context.Context) Option { + return func(o *Options) { + o.Context = val + } +} + +// Config provides a function to set the config option. +func Config(val *config.Config) Option { + return func(o *Options) { + o.Config = val + } +} diff --git a/extensions/group/pkg/server/debug/server.go b/extensions/group/pkg/server/debug/server.go new file mode 100644 index 0000000000..e323840cae --- /dev/null +++ b/extensions/group/pkg/server/debug/server.go @@ -0,0 +1,63 @@ +package debug + +import ( + "io" + "net/http" + + "github.com/owncloud/ocis/extensions/group/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/service/debug" + "github.com/owncloud/ocis/ocis-pkg/version" +) + +// Server initializes the debug service and server. +func Server(opts ...Option) (*http.Server, error) { + options := newOptions(opts...) + + return debug.NewService( + debug.Logger(options.Logger), + debug.Name(options.Config.Service.Name), + debug.Version(version.String), + debug.Address(options.Config.Debug.Addr), + debug.Token(options.Config.Debug.Token), + debug.Pprof(options.Config.Debug.Pprof), + debug.Zpages(options.Config.Debug.Zpages), + debug.Health(health(options.Config)), + debug.Ready(ready(options.Config)), + //debug.CorsAllowedOrigins(options.Config.HTTP.CORS.AllowedOrigins), + //debug.CorsAllowedMethods(options.Config.HTTP.CORS.AllowedMethods), + //debug.CorsAllowedHeaders(options.Config.HTTP.CORS.AllowedHeaders), + //debug.CorsAllowCredentials(options.Config.HTTP.CORS.AllowCredentials), + ), nil +} + +// health implements the health check. +func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} + +// ready implements the ready check. +func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} diff --git a/extensions/ocdav/pkg/command/ocdav.go b/extensions/ocdav/pkg/command/ocdav.go index 20bb8a29b6..3426e38957 100644 --- a/extensions/ocdav/pkg/command/ocdav.go +++ b/extensions/ocdav/pkg/command/ocdav.go @@ -9,7 +9,7 @@ import ( "github.com/oklog/run" "github.com/owncloud/ocis/extensions/ocdav/pkg/config" "github.com/owncloud/ocis/extensions/ocdav/pkg/config/parser" - "github.com/owncloud/ocis/extensions/storage/pkg/server/debug" + "github.com/owncloud/ocis/extensions/ocdav/pkg/server/debug" ociscfg "github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/log" "github.com/owncloud/ocis/ocis-pkg/sync" @@ -77,13 +77,9 @@ func OCDav(cfg *config.Config) *cli.Command { { server, err := debug.Server( - debug.Name(c.Command.Name+"-debug"), - debug.Addr(cfg.Debug.Addr), debug.Logger(logger), debug.Context(ctx), - debug.Pprof(cfg.Debug.Pprof), - debug.Zpages(cfg.Debug.Zpages), - debug.Token(cfg.Debug.Token), + debug.Config(cfg), ) if err != nil { diff --git a/extensions/ocdav/pkg/server/debug/option.go b/extensions/ocdav/pkg/server/debug/option.go new file mode 100644 index 0000000000..01bda4d86c --- /dev/null +++ b/extensions/ocdav/pkg/server/debug/option.go @@ -0,0 +1,50 @@ +package debug + +import ( + "context" + + "github.com/owncloud/ocis/extensions/ocdav/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/log" +) + +// Option defines a single option function. +type Option func(o *Options) + +// Options defines the available options for this package. +type Options struct { + Logger log.Logger + Context context.Context + Config *config.Config +} + +// newOptions initializes the available default options. +func newOptions(opts ...Option) Options { + opt := Options{} + + for _, o := range opts { + o(&opt) + } + + return opt +} + +// Logger provides a function to set the logger option. +func Logger(val log.Logger) Option { + return func(o *Options) { + o.Logger = val + } +} + +// Context provides a function to set the context option. +func Context(val context.Context) Option { + return func(o *Options) { + o.Context = val + } +} + +// Config provides a function to set the config option. +func Config(val *config.Config) Option { + return func(o *Options) { + o.Config = val + } +} diff --git a/extensions/ocdav/pkg/server/debug/server.go b/extensions/ocdav/pkg/server/debug/server.go new file mode 100644 index 0000000000..6a7838accd --- /dev/null +++ b/extensions/ocdav/pkg/server/debug/server.go @@ -0,0 +1,63 @@ +package debug + +import ( + "io" + "net/http" + + "github.com/owncloud/ocis/extensions/ocdav/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/service/debug" + "github.com/owncloud/ocis/ocis-pkg/version" +) + +// Server initializes the debug service and server. +func Server(opts ...Option) (*http.Server, error) { + options := newOptions(opts...) + + return debug.NewService( + debug.Logger(options.Logger), + debug.Name(options.Config.Service.Name), + debug.Version(version.String), + debug.Address(options.Config.Debug.Addr), + debug.Token(options.Config.Debug.Token), + debug.Pprof(options.Config.Debug.Pprof), + debug.Zpages(options.Config.Debug.Zpages), + debug.Health(health(options.Config)), + debug.Ready(ready(options.Config)), + //debug.CorsAllowedOrigins(options.Config.HTTP.CORS.AllowedOrigins), + //debug.CorsAllowedMethods(options.Config.HTTP.CORS.AllowedMethods), + //debug.CorsAllowedHeaders(options.Config.HTTP.CORS.AllowedHeaders), + //debug.CorsAllowCredentials(options.Config.HTTP.CORS.AllowCredentials), + ), nil +} + +// health implements the health check. +func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} + +// ready implements the ready check. +func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} diff --git a/extensions/sharing/pkg/command/command.go b/extensions/sharing/pkg/command/command.go index 29cde19357..2e0eca8d14 100644 --- a/extensions/sharing/pkg/command/command.go +++ b/extensions/sharing/pkg/command/command.go @@ -17,7 +17,7 @@ import ( "github.com/oklog/run" "github.com/owncloud/ocis/extensions/sharing/pkg/config" "github.com/owncloud/ocis/extensions/sharing/pkg/config/parser" - "github.com/owncloud/ocis/extensions/storage/pkg/server/debug" + "github.com/owncloud/ocis/extensions/sharing/pkg/server/debug" ociscfg "github.com/owncloud/ocis/ocis-pkg/config" "github.com/thejerf/suture/v4" "github.com/urfave/cli/v2" @@ -81,13 +81,9 @@ func Sharing(cfg *config.Config) *cli.Command { }) debug, err := debug.Server( - debug.Name(c.Command.Name+"-debug"), - debug.Addr(cfg.Debug.Addr), debug.Logger(logger), debug.Context(ctx), - debug.Pprof(cfg.Debug.Pprof), - debug.Zpages(cfg.Debug.Zpages), - debug.Token(cfg.Debug.Token), + debug.Config(cfg), ) if err != nil { diff --git a/extensions/sharing/pkg/server/debug/option.go b/extensions/sharing/pkg/server/debug/option.go new file mode 100644 index 0000000000..9667bca9e4 --- /dev/null +++ b/extensions/sharing/pkg/server/debug/option.go @@ -0,0 +1,50 @@ +package debug + +import ( + "context" + + "github.com/owncloud/ocis/extensions/sharing/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/log" +) + +// Option defines a single option function. +type Option func(o *Options) + +// Options defines the available options for this package. +type Options struct { + Logger log.Logger + Context context.Context + Config *config.Config +} + +// newOptions initializes the available default options. +func newOptions(opts ...Option) Options { + opt := Options{} + + for _, o := range opts { + o(&opt) + } + + return opt +} + +// Logger provides a function to set the logger option. +func Logger(val log.Logger) Option { + return func(o *Options) { + o.Logger = val + } +} + +// Context provides a function to set the context option. +func Context(val context.Context) Option { + return func(o *Options) { + o.Context = val + } +} + +// Config provides a function to set the config option. +func Config(val *config.Config) Option { + return func(o *Options) { + o.Config = val + } +} diff --git a/extensions/sharing/pkg/server/debug/server.go b/extensions/sharing/pkg/server/debug/server.go new file mode 100644 index 0000000000..d7ce79028f --- /dev/null +++ b/extensions/sharing/pkg/server/debug/server.go @@ -0,0 +1,63 @@ +package debug + +import ( + "io" + "net/http" + + "github.com/owncloud/ocis/extensions/sharing/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/service/debug" + "github.com/owncloud/ocis/ocis-pkg/version" +) + +// Server initializes the debug service and server. +func Server(opts ...Option) (*http.Server, error) { + options := newOptions(opts...) + + return debug.NewService( + debug.Logger(options.Logger), + debug.Name(options.Config.Service.Name), + debug.Version(version.String), + debug.Address(options.Config.Debug.Addr), + debug.Token(options.Config.Debug.Token), + debug.Pprof(options.Config.Debug.Pprof), + debug.Zpages(options.Config.Debug.Zpages), + debug.Health(health(options.Config)), + debug.Ready(ready(options.Config)), + //debug.CorsAllowedOrigins(options.Config.HTTP.CORS.AllowedOrigins), + //debug.CorsAllowedMethods(options.Config.HTTP.CORS.AllowedMethods), + //debug.CorsAllowedHeaders(options.Config.HTTP.CORS.AllowedHeaders), + //debug.CorsAllowCredentials(options.Config.HTTP.CORS.AllowCredentials), + ), nil +} + +// health implements the health check. +func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} + +// ready implements the ready check. +func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} diff --git a/extensions/storage-metadata/pkg/command/command.go b/extensions/storage-metadata/pkg/command/command.go index 54eff79d45..5d9f4d760b 100644 --- a/extensions/storage-metadata/pkg/command/command.go +++ b/extensions/storage-metadata/pkg/command/command.go @@ -13,10 +13,10 @@ import ( "github.com/oklog/run" "github.com/owncloud/ocis/extensions/storage-metadata/pkg/config" "github.com/owncloud/ocis/extensions/storage-metadata/pkg/config/parser" - "github.com/owncloud/ocis/extensions/storage/pkg/server/debug" - "github.com/owncloud/ocis/extensions/storage/pkg/service/external" + "github.com/owncloud/ocis/extensions/storage-metadata/pkg/server/debug" ociscfg "github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/log" + "github.com/owncloud/ocis/ocis-pkg/service/external" "github.com/owncloud/ocis/ocis-pkg/sync" "github.com/owncloud/ocis/ocis-pkg/tracing" "github.com/owncloud/ocis/ocis-pkg/version" @@ -78,13 +78,9 @@ func StorageMetadata(cfg *config.Config) *cli.Command { }) debugServer, err := debug.Server( - debug.Name(c.Command.Name+"-debug"), - debug.Addr(cfg.Debug.Addr), debug.Logger(logger), debug.Context(ctx), - debug.Pprof(cfg.Debug.Pprof), - debug.Zpages(cfg.Debug.Zpages), - debug.Token(cfg.Debug.Token), + debug.Config(cfg), ) if err != nil { diff --git a/extensions/storage-metadata/pkg/server/debug/option.go b/extensions/storage-metadata/pkg/server/debug/option.go new file mode 100644 index 0000000000..b138e2e70a --- /dev/null +++ b/extensions/storage-metadata/pkg/server/debug/option.go @@ -0,0 +1,50 @@ +package debug + +import ( + "context" + + "github.com/owncloud/ocis/extensions/storage-metadata/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/log" +) + +// Option defines a single option function. +type Option func(o *Options) + +// Options defines the available options for this package. +type Options struct { + Logger log.Logger + Context context.Context + Config *config.Config +} + +// newOptions initializes the available default options. +func newOptions(opts ...Option) Options { + opt := Options{} + + for _, o := range opts { + o(&opt) + } + + return opt +} + +// Logger provides a function to set the logger option. +func Logger(val log.Logger) Option { + return func(o *Options) { + o.Logger = val + } +} + +// Context provides a function to set the context option. +func Context(val context.Context) Option { + return func(o *Options) { + o.Context = val + } +} + +// Config provides a function to set the config option. +func Config(val *config.Config) Option { + return func(o *Options) { + o.Config = val + } +} diff --git a/extensions/storage-metadata/pkg/server/debug/server.go b/extensions/storage-metadata/pkg/server/debug/server.go new file mode 100644 index 0000000000..1ce0a803a8 --- /dev/null +++ b/extensions/storage-metadata/pkg/server/debug/server.go @@ -0,0 +1,63 @@ +package debug + +import ( + "io" + "net/http" + + "github.com/owncloud/ocis/extensions/storage-metadata/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/service/debug" + "github.com/owncloud/ocis/ocis-pkg/version" +) + +// Server initializes the debug service and server. +func Server(opts ...Option) (*http.Server, error) { + options := newOptions(opts...) + + return debug.NewService( + debug.Logger(options.Logger), + debug.Name(options.Config.Service.Name), + debug.Version(version.String), + debug.Address(options.Config.Debug.Addr), + debug.Token(options.Config.Debug.Token), + debug.Pprof(options.Config.Debug.Pprof), + debug.Zpages(options.Config.Debug.Zpages), + debug.Health(health(options.Config)), + debug.Ready(ready(options.Config)), + //debug.CorsAllowedOrigins(options.Config.HTTP.CORS.AllowedOrigins), + //debug.CorsAllowedMethods(options.Config.HTTP.CORS.AllowedMethods), + //debug.CorsAllowedHeaders(options.Config.HTTP.CORS.AllowedHeaders), + //debug.CorsAllowCredentials(options.Config.HTTP.CORS.AllowCredentials), + ), nil +} + +// health implements the health check. +func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} + +// ready implements the ready check. +func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} diff --git a/extensions/storage-publiclink/pkg/command/storagepubliclink.go b/extensions/storage-publiclink/pkg/command/storagepubliclink.go index 06fe7ada8a..78996e6597 100644 --- a/extensions/storage-publiclink/pkg/command/storagepubliclink.go +++ b/extensions/storage-publiclink/pkg/command/storagepubliclink.go @@ -12,7 +12,7 @@ import ( "github.com/oklog/run" "github.com/owncloud/ocis/extensions/storage-publiclink/pkg/config" "github.com/owncloud/ocis/extensions/storage-publiclink/pkg/config/parser" - "github.com/owncloud/ocis/extensions/storage/pkg/server/debug" + "github.com/owncloud/ocis/extensions/storage-publiclink/pkg/server/debug" ociscfg "github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/log" "github.com/owncloud/ocis/ocis-pkg/sync" @@ -66,13 +66,9 @@ func StoragePublicLink(cfg *config.Config) *cli.Command { }) debugServer, err := debug.Server( - debug.Name(c.Command.Name+"-debug"), - debug.Addr(cfg.Debug.Addr), debug.Logger(logger), debug.Context(ctx), - debug.Pprof(cfg.Debug.Pprof), - debug.Zpages(cfg.Debug.Zpages), - debug.Token(cfg.Debug.Token), + debug.Config(cfg), ) if err != nil { diff --git a/extensions/storage-publiclink/pkg/server/debug/option.go b/extensions/storage-publiclink/pkg/server/debug/option.go new file mode 100644 index 0000000000..d2cccd3437 --- /dev/null +++ b/extensions/storage-publiclink/pkg/server/debug/option.go @@ -0,0 +1,50 @@ +package debug + +import ( + "context" + + "github.com/owncloud/ocis/extensions/storage-publiclink/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/log" +) + +// Option defines a single option function. +type Option func(o *Options) + +// Options defines the available options for this package. +type Options struct { + Logger log.Logger + Context context.Context + Config *config.Config +} + +// newOptions initializes the available default options. +func newOptions(opts ...Option) Options { + opt := Options{} + + for _, o := range opts { + o(&opt) + } + + return opt +} + +// Logger provides a function to set the logger option. +func Logger(val log.Logger) Option { + return func(o *Options) { + o.Logger = val + } +} + +// Context provides a function to set the context option. +func Context(val context.Context) Option { + return func(o *Options) { + o.Context = val + } +} + +// Config provides a function to set the config option. +func Config(val *config.Config) Option { + return func(o *Options) { + o.Config = val + } +} diff --git a/extensions/storage-publiclink/pkg/server/debug/server.go b/extensions/storage-publiclink/pkg/server/debug/server.go new file mode 100644 index 0000000000..fe2896014f --- /dev/null +++ b/extensions/storage-publiclink/pkg/server/debug/server.go @@ -0,0 +1,63 @@ +package debug + +import ( + "io" + "net/http" + + "github.com/owncloud/ocis/extensions/storage-publiclink/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/service/debug" + "github.com/owncloud/ocis/ocis-pkg/version" +) + +// Server initializes the debug service and server. +func Server(opts ...Option) (*http.Server, error) { + options := newOptions(opts...) + + return debug.NewService( + debug.Logger(options.Logger), + debug.Name(options.Config.Service.Name), + debug.Version(version.String), + debug.Address(options.Config.Debug.Addr), + debug.Token(options.Config.Debug.Token), + debug.Pprof(options.Config.Debug.Pprof), + debug.Zpages(options.Config.Debug.Zpages), + debug.Health(health(options.Config)), + debug.Ready(ready(options.Config)), + //debug.CorsAllowedOrigins(options.Config.HTTP.CORS.AllowedOrigins), + //debug.CorsAllowedMethods(options.Config.HTTP.CORS.AllowedMethods), + //debug.CorsAllowedHeaders(options.Config.HTTP.CORS.AllowedHeaders), + //debug.CorsAllowCredentials(options.Config.HTTP.CORS.AllowCredentials), + ), nil +} + +// health implements the health check. +func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} + +// ready implements the ready check. +func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} diff --git a/extensions/storage-shares/pkg/command/command.go b/extensions/storage-shares/pkg/command/command.go index 6964706456..ba9efc6457 100644 --- a/extensions/storage-shares/pkg/command/command.go +++ b/extensions/storage-shares/pkg/command/command.go @@ -16,7 +16,7 @@ import ( "github.com/oklog/run" "github.com/owncloud/ocis/extensions/storage-shares/pkg/config" "github.com/owncloud/ocis/extensions/storage-shares/pkg/config/parser" - "github.com/owncloud/ocis/extensions/storage/pkg/server/debug" + "github.com/owncloud/ocis/extensions/storage-shares/pkg/server/debug" ociscfg "github.com/owncloud/ocis/ocis-pkg/config" "github.com/thejerf/suture/v4" "github.com/urfave/cli/v2" @@ -68,13 +68,9 @@ func StorageShares(cfg *config.Config) *cli.Command { }) debugServer, err := debug.Server( - debug.Name(c.Command.Name+"-debug"), - debug.Addr(cfg.Debug.Addr), debug.Logger(logger), debug.Context(ctx), - debug.Pprof(cfg.Debug.Pprof), - debug.Zpages(cfg.Debug.Zpages), - debug.Token(cfg.Debug.Token), + debug.Config(cfg), ) if err != nil { diff --git a/extensions/storage/pkg/server/debug/option.go b/extensions/storage-shares/pkg/server/debug/option.go similarity index 53% rename from extensions/storage/pkg/server/debug/option.go rename to extensions/storage-shares/pkg/server/debug/option.go index 8e84764913..a671b3ec76 100644 --- a/extensions/storage/pkg/server/debug/option.go +++ b/extensions/storage-shares/pkg/server/debug/option.go @@ -3,7 +3,7 @@ package debug import ( "context" - "github.com/owncloud/ocis/extensions/storage/pkg/config" + "github.com/owncloud/ocis/extensions/storage-shares/pkg/config" "github.com/owncloud/ocis/ocis-pkg/log" ) @@ -12,14 +12,9 @@ type Option func(o *Options) // Options defines the available options for this package. type Options struct { - Name string - Addr string Logger log.Logger Context context.Context Config *config.Config - Pprof bool - Zpages bool - Token string } // newOptions initializes the available default options. @@ -33,20 +28,6 @@ func newOptions(opts ...Option) Options { return opt } -// Name provides a function to set the name option. -func Name(val string) Option { - return func(o *Options) { - o.Name = val - } -} - -// Addr provides a function to set the addr option. -func Addr(val string) Option { - return func(o *Options) { - o.Addr = val - } -} - // Logger provides a function to set the logger option. func Logger(val log.Logger) Option { return func(o *Options) { @@ -67,24 +48,3 @@ func Config(val *config.Config) Option { o.Config = val } } - -// Pprof provides a function to set the pprof option. -func Pprof(val bool) Option { - return func(o *Options) { - o.Pprof = val - } -} - -// Zpages provides a function to set the zpages option. -func Zpages(val bool) Option { - return func(o *Options) { - o.Zpages = val - } -} - -// Token provides a function to set the token option. -func Token(val string) Option { - return func(o *Options) { - o.Token = val - } -} diff --git a/extensions/storage-shares/pkg/server/debug/server.go b/extensions/storage-shares/pkg/server/debug/server.go new file mode 100644 index 0000000000..666c3b3b14 --- /dev/null +++ b/extensions/storage-shares/pkg/server/debug/server.go @@ -0,0 +1,63 @@ +package debug + +import ( + "io" + "net/http" + + "github.com/owncloud/ocis/extensions/storage-shares/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/service/debug" + "github.com/owncloud/ocis/ocis-pkg/version" +) + +// Server initializes the debug service and server. +func Server(opts ...Option) (*http.Server, error) { + options := newOptions(opts...) + + return debug.NewService( + debug.Logger(options.Logger), + debug.Name(options.Config.Service.Name), + debug.Version(version.String), + debug.Address(options.Config.Debug.Addr), + debug.Token(options.Config.Debug.Token), + debug.Pprof(options.Config.Debug.Pprof), + debug.Zpages(options.Config.Debug.Zpages), + debug.Health(health(options.Config)), + debug.Ready(ready(options.Config)), + //debug.CorsAllowedOrigins(options.Config.HTTP.CORS.AllowedOrigins), + //debug.CorsAllowedMethods(options.Config.HTTP.CORS.AllowedMethods), + //debug.CorsAllowedHeaders(options.Config.HTTP.CORS.AllowedHeaders), + //debug.CorsAllowCredentials(options.Config.HTTP.CORS.AllowCredentials), + ), nil +} + +// health implements the health check. +func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} + +// ready implements the ready check. +func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} diff --git a/extensions/storage-users/pkg/command/command.go b/extensions/storage-users/pkg/command/command.go index 5e48a2db03..766631f6a5 100644 --- a/extensions/storage-users/pkg/command/command.go +++ b/extensions/storage-users/pkg/command/command.go @@ -12,7 +12,7 @@ import ( "github.com/oklog/run" "github.com/owncloud/ocis/extensions/storage-users/pkg/config" "github.com/owncloud/ocis/extensions/storage-users/pkg/config/parser" - "github.com/owncloud/ocis/extensions/storage/pkg/server/debug" + "github.com/owncloud/ocis/extensions/storage-users/pkg/server/debug" ociscfg "github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/log" "github.com/owncloud/ocis/ocis-pkg/sync" @@ -67,13 +67,9 @@ func StorageUsers(cfg *config.Config) *cli.Command { }) debugServer, err := debug.Server( - debug.Name(c.Command.Name+"-debug"), - debug.Addr(cfg.Debug.Addr), debug.Logger(logger), debug.Context(ctx), - debug.Pprof(cfg.Debug.Pprof), - debug.Zpages(cfg.Debug.Zpages), - debug.Token(cfg.Debug.Token), + debug.Config(cfg), ) if err != nil { diff --git a/extensions/storage-users/pkg/server/debug/option.go b/extensions/storage-users/pkg/server/debug/option.go new file mode 100644 index 0000000000..7493b21c48 --- /dev/null +++ b/extensions/storage-users/pkg/server/debug/option.go @@ -0,0 +1,50 @@ +package debug + +import ( + "context" + + "github.com/owncloud/ocis/extensions/storage-users/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/log" +) + +// Option defines a single option function. +type Option func(o *Options) + +// Options defines the available options for this package. +type Options struct { + Logger log.Logger + Context context.Context + Config *config.Config +} + +// newOptions initializes the available default options. +func newOptions(opts ...Option) Options { + opt := Options{} + + for _, o := range opts { + o(&opt) + } + + return opt +} + +// Logger provides a function to set the logger option. +func Logger(val log.Logger) Option { + return func(o *Options) { + o.Logger = val + } +} + +// Context provides a function to set the context option. +func Context(val context.Context) Option { + return func(o *Options) { + o.Context = val + } +} + +// Config provides a function to set the config option. +func Config(val *config.Config) Option { + return func(o *Options) { + o.Config = val + } +} diff --git a/extensions/storage-users/pkg/server/debug/server.go b/extensions/storage-users/pkg/server/debug/server.go new file mode 100644 index 0000000000..65c9fdc7a8 --- /dev/null +++ b/extensions/storage-users/pkg/server/debug/server.go @@ -0,0 +1,63 @@ +package debug + +import ( + "io" + "net/http" + + "github.com/owncloud/ocis/extensions/storage-users/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/service/debug" + "github.com/owncloud/ocis/ocis-pkg/version" +) + +// Server initializes the debug service and server. +func Server(opts ...Option) (*http.Server, error) { + options := newOptions(opts...) + + return debug.NewService( + debug.Logger(options.Logger), + debug.Name(options.Config.Service.Name), + debug.Version(version.String), + debug.Address(options.Config.Debug.Addr), + debug.Token(options.Config.Debug.Token), + debug.Pprof(options.Config.Debug.Pprof), + debug.Zpages(options.Config.Debug.Zpages), + debug.Health(health(options.Config)), + debug.Ready(ready(options.Config)), + //debug.CorsAllowedOrigins(options.Config.HTTP.CORS.AllowedOrigins), + //debug.CorsAllowedMethods(options.Config.HTTP.CORS.AllowedMethods), + //debug.CorsAllowedHeaders(options.Config.HTTP.CORS.AllowedHeaders), + //debug.CorsAllowCredentials(options.Config.HTTP.CORS.AllowCredentials), + ), nil +} + +// health implements the health check. +func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} + +// ready implements the ready check. +func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + + // TODO: check if services are up and running + + _, err := io.WriteString(w, http.StatusText(http.StatusOK)) + // io.WriteString should not fail but if it does we want to know. + if err != nil { + panic(err) + } + } +} diff --git a/extensions/storage/.dockerignore b/extensions/storage/.dockerignore deleted file mode 100644 index 4ec85b5e4f..0000000000 --- a/extensions/storage/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!bin/ diff --git a/extensions/storage/Makefile b/extensions/storage/Makefile deleted file mode 100644 index bb9471219d..0000000000 --- a/extensions/storage/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -SHELL := bash -NAME := storage - -include ../../.make/recursion.mk - -############ tooling ############ -ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI -include ../../.bingo/Variables.mk -endif - -############ go tooling ############ -include ../../.make/go.mk - -############ release ######### -include ../../.make/release.mk - -############ docs generate ############ -include ../../.make/docs.mk - -.PHONY: docs-generate -docs-generate: config-docs-generate - -############ generate ############ -include ../../.make/generate.mk - -.PHONY: ci-go-generate -ci-go-generate: # CI runs ci-node-generate automatically before this target - -.PHONY: ci-node-generate -ci-node-generate: - -############ licenses ############ -.PHONY: ci-node-check-licenses -ci-node-check-licenses: - -.PHONY: ci-node-save-licenses -ci-node-save-licenses: diff --git a/extensions/storage/cmd/storage/main.go b/extensions/storage/cmd/storage/main.go deleted file mode 100644 index 2941f76e77..0000000000 --- a/extensions/storage/cmd/storage/main.go +++ /dev/null @@ -1,14 +0,0 @@ -package main - -import ( - "os" - - "github.com/owncloud/ocis/extensions/storage/pkg/command" - "github.com/owncloud/ocis/extensions/storage/pkg/config/defaults" -) - -func main() { - if err := command.Execute(defaults.DefaultConfig()); err != nil { - os.Exit(1) - } -} diff --git a/extensions/storage/docker/Dockerfile.linux.amd64 b/extensions/storage/docker/Dockerfile.linux.amd64 deleted file mode 100644 index 231e033f2e..0000000000 --- a/extensions/storage/docker/Dockerfile.linux.amd64 +++ /dev/null @@ -1,19 +0,0 @@ -FROM amd64/alpine:latest - -RUN apk update && \ - apk upgrade && \ - apk add ca-certificates mailcap && \ - rm -rf /var/cache/apk/* && \ - echo 'hosts: files dns' >| /etc/nsswitch.conf - -LABEL maintainer="ownCloud GmbH " \ - org.label-schema.name="oCIS Reva" \ - org.label-schema.vendor="ownCloud GmbH" \ - org.label-schema.schema-version="1.0" - -EXPOSE 9140 9141 9142 9143 - -ENTRYPOINT ["/usr/bin/ocis-reva"] -CMD ["server"] - -COPY bin/ocis-reva /usr/bin/ocis-reva diff --git a/extensions/storage/docker/Dockerfile.linux.arm b/extensions/storage/docker/Dockerfile.linux.arm deleted file mode 100644 index af07021030..0000000000 --- a/extensions/storage/docker/Dockerfile.linux.arm +++ /dev/null @@ -1,19 +0,0 @@ -FROM arm32v6/alpine:latest - -RUN apk update && \ - apk upgrade && \ - apk add ca-certificates mailcap && \ - rm -rf /var/cache/apk/* && \ - echo 'hosts: files dns' >| /etc/nsswitch.conf - -LABEL maintainer="ownCloud GmbH " \ - org.label-schema.name="oCIS Reva" \ - org.label-schema.vendor="ownCloud GmbH" \ - org.label-schema.schema-version="1.0" - -EXPOSE 9140 9141 9142 9143 - -ENTRYPOINT ["/usr/bin/ocis-reva"] -CMD ["server"] - -COPY bin/ocis-reva /usr/bin/ocis-reva diff --git a/extensions/storage/docker/Dockerfile.linux.arm64 b/extensions/storage/docker/Dockerfile.linux.arm64 deleted file mode 100644 index e8f5ac3626..0000000000 --- a/extensions/storage/docker/Dockerfile.linux.arm64 +++ /dev/null @@ -1,19 +0,0 @@ -FROM arm64v8/alpine:latest - -RUN apk update && \ - apk upgrade && \ - apk add ca-certificates mailcap && \ - rm -rf /var/cache/apk/* && \ - echo 'hosts: files dns' >| /etc/nsswitch.conf - -LABEL maintainer="ownCloud GmbH " \ - org.label-schema.name="oCIS Reva" \ - org.label-schema.vendor="ownCloud GmbH" \ - org.label-schema.schema-version="1.0" - -EXPOSE 9140 9141 9142 9143 - -ENTRYPOINT ["/usr/bin/ocis-reva"] -CMD ["server"] - -COPY bin/ocis-reva /usr/bin/ocis-reva diff --git a/extensions/storage/docker/manifest.tmpl b/extensions/storage/docker/manifest.tmpl deleted file mode 100644 index ac5ae8e046..0000000000 --- a/extensions/storage/docker/manifest.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -image: owncloud/ocis-reva:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}} -{{#if build.tags}} -tags: -{{#each build.tags}} - - {{this}} -{{/each}} -{{/if}} -manifests: - - image: owncloud/ocis-reva:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64 - platform: - architecture: amd64 - os: linux - - image: owncloud/ocis-reva:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64 - platform: - architecture: arm64 - variant: v8 - os: linux - - image: owncloud/ocis-reva:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm - platform: - architecture: arm - variant: v6 - os: linux diff --git a/extensions/storage/pkg/command/health.go b/extensions/storage/pkg/command/health.go deleted file mode 100644 index 1d8882e37d..0000000000 --- a/extensions/storage/pkg/command/health.go +++ /dev/null @@ -1,48 +0,0 @@ -package command - -import ( - "fmt" - "net/http" - - "github.com/owncloud/ocis/extensions/storage/pkg/config" - "github.com/urfave/cli/v2" -) - -// Health is the entrypoint for the health command. -func Health(cfg *config.Config) *cli.Command { - return &cli.Command{ - Name: "health", - Usage: "check health status", - Category: "info", - Action: func(c *cli.Context) error { - logger := NewLogger(cfg) - - resp, err := http.Get( - fmt.Sprintf( - "http://%s/healthz", - cfg.Debug.Addr, - ), - ) - - if err != nil { - logger.Fatal(). - Err(err). - Msg("Failed to request health check") - } - - defer resp.Body.Close() - - if resp.StatusCode != http.StatusOK { - logger.Fatal(). - Int("code", resp.StatusCode). - Msg("Health seems to be in bad state") - } - - logger.Debug(). - Int("code", resp.StatusCode). - Msg("Health got a good state") - - return nil - }, - } -} diff --git a/extensions/storage/pkg/command/root.go b/extensions/storage/pkg/command/root.go deleted file mode 100644 index 864c281f52..0000000000 --- a/extensions/storage/pkg/command/root.go +++ /dev/null @@ -1,45 +0,0 @@ -package command - -import ( - "os" - - "github.com/owncloud/ocis/extensions/storage/pkg/config" - "github.com/owncloud/ocis/ocis-pkg/clihelper" - "github.com/owncloud/ocis/ocis-pkg/log" - "github.com/urfave/cli/v2" -) - -// GetCommands provides all commands for this service -func GetCommands(cfg *config.Config) cli.Commands { - return []*cli.Command{ - Health(cfg), - } -} - -// Execute is the entry point for the storage command. -func Execute(cfg *config.Config) error { - app := clihelper.DefaultApp(&cli.App{ - Name: "storage", - Usage: "Storage service for oCIS", - - Commands: GetCommands(cfg), - }) - - cli.HelpFlag = &cli.BoolFlag{ - Name: "help,h", - Usage: "Show the help", - } - - 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), - ) -} diff --git a/extensions/storage/pkg/config/config.go b/extensions/storage/pkg/config/config.go deleted file mode 100644 index c3a626e40f..0000000000 --- a/extensions/storage/pkg/config/config.go +++ /dev/null @@ -1,1848 +0,0 @@ -package config - -import ( - "context" - - "github.com/owncloud/ocis/ocis-pkg/shared" -) - -// Log defines the available logging configuration. -type Log struct { - Level string `yaml:"level"` - Pretty bool `yaml:"pretty"` - Color bool `yaml:"color"` - File string `yaml:"file"` -} - -// Debug defines the available debug configuration. -type Debug struct { - Addr string `yaml:"addr"` - Token string `yaml:"token"` - Pprof bool `yaml:"pprof"` - Zpages bool `yaml:"zpages"` -} - -// Gateway defines the available gateway configuration. -type Gateway struct { - Port - CommitShareToStorageGrant bool `yaml:"commit_share_to_storage_grant"` - CommitShareToStorageRef bool `yaml:"commit_share_to_storage_ref"` - DisableHomeCreationOnLogin bool `yaml:"disable_home_creation_on_login"` - ShareFolder string `yaml:"share_folder"` - LinkGrants string `yaml:"link_grants"` - HomeMapping string `yaml:"home_mapping"` - EtagCacheTTL int `yaml:"etag_cache_ttl"` -} - -// StorageRegistry defines the available storage registry configuration -type StorageRegistry struct { - Driver string `yaml:"driver"` - // HomeProvider is the path in the global namespace that the static storage registry uses to determine the home storage - HomeProvider string `yaml:"home_provider"` - Rules []string `yaml:"rules"` - JSON string `yaml:"json"` -} - -// AppRegistry defines the available app registry configuration -type AppRegistry struct { - Driver string `yaml:"driver"` - MimetypesJSON string `yaml:"mime_types_json"` -} - -// AppProvider defines the available app provider configuration -type AppProvider struct { - Port - ExternalAddr string `yaml:"external_addr"` - Driver string `yaml:"driver"` - WopiDriver WopiDriver `yaml:"wopi_driver"` - AppsURL string `yaml:"apps_url"` - OpenURL string `yaml:"open_url"` - NewURL string `yaml:"new_url"` -} - -type WopiDriver struct { - AppAPIKey string `yaml:"app_api_key"` - AppDesktopOnly bool `yaml:"app_desktop_only"` - AppIconURI string `yaml:"app_icon_uri"` - AppInternalURL string `yaml:"app_internal_url"` - AppName string `yaml:"app_name"` - AppURL string `yaml:"app_url"` - Insecure bool `yaml:"insecure"` - IopSecret string `yaml:"ipo_secret"` - JWTSecret string `yaml:"jwt_secret"` - WopiURL string `yaml:"wopi_url"` -} - -// Sharing defines the available sharing configuration. -type Sharing struct { - Port - UserDriver string `yaml:"user_driver"` - UserJSONFile string `yaml:"user_json_file"` - CS3ProviderAddr string `yaml:"provider_addr"` - CS3ServiceUser string `yaml:"service_user_id"` - CS3ServiceUserIdp string `yaml:"service_user_idp"` - UserSQLUsername string `yaml:"user_sql_username"` - UserSQLPassword string `yaml:"user_sql_password"` - UserSQLHost string `yaml:"user_sql_host"` - UserSQLPort int `yaml:"user_sql_port"` - UserSQLName string `yaml:"user_sql_name"` - PublicDriver string `yaml:"public_driver"` - PublicJSONFile string `yaml:"public_json_file"` - PublicPasswordHashCost int `yaml:"public_password_hash_cost"` - PublicEnableExpiredSharesCleanup bool `yaml:"public_enable_expired_shares_cleanup"` - PublicJanitorRunInterval int `yaml:"public_janitor_run_interval"` - UserStorageMountID string `yaml:"user_storage_mount_id"` - Events Events `yaml:"events"` -} - -type Events struct { - Address string `yaml:"address"` - ClusterID string `yaml:"cluster_id"` -} - -// Port defines the available port configuration. -type Port struct { - // MaxCPUs can be a number or a percentage - MaxCPUs string `yaml:"max_cpus"` - LogLevel string `yaml:"log_level"` - // GRPCNetwork can be tcp, udp or unix - GRPCNetwork string `yaml:"grpc_network"` - // GRPCAddr to listen on, hostname:port (0.0.0.0:9999 for all interfaces) or socket (/var/run/reva/sock) - GRPCAddr string `yaml:"grpc_addr"` - // Protocol can be grpc or http - // HTTPNetwork can be tcp, udp or unix - HTTPNetwork string `yaml:"http_network"` - // HTTPAddr to listen on, hostname:port (0.0.0.0:9100 for all interfaces) or socket (/var/run/reva/sock) - HTTPAddr string `yaml:"http_addr"` - // Protocol can be grpc or http - Protocol string `yaml:"protocol"` - // Endpoint is used by the gateway and registries (eg localhost:9100 or cloud.example.com) - Endpoint string `yaml:"endpoint"` - // DebugAddr for the debug endpoint to bind to - DebugAddr string `yaml:"debug_addr"` - // Services can be used to give a list of services that should be started on this port - Services []string `yaml:"services"` - // Config can be used to configure the reva instance. - // Services and Protocol will be ignored if this is used - Config map[string]interface{} `yaml:"config"` - - // Context allows for context cancellation and propagation - Context context.Context - - // Supervised is used when running under an oCIS runtime supervision tree - Supervised bool // deprecated // TODO: delete me -} - -// Users defines the available users configuration. -type Users struct { - Port - Driver string `yaml:"driver"` - JSON string `yaml:"json"` - UserGroupsCacheExpiration int `yaml:"user_groups_cache_expiration"` -} - -// AuthMachineConfig defines the available configuration for the machine auth driver. -type AuthMachineConfig struct { - MachineAuthAPIKey string `yaml:"machine_auth_api_key"` -} - -// Groups defines the available groups configuration. -type Groups struct { - Port - Driver string `yaml:"driver"` - JSON string `yaml:"json"` - GroupMembersCacheExpiration int `yaml:"group_members_cache_expiration"` -} - -// FrontendPort defines the available frontend configuration. -type FrontendPort struct { - Port - - AppProviderInsecure bool `yaml:"app_provider_insecure"` - AppProviderPrefix string `yaml:"app_provider_prefix"` - ArchiverInsecure bool `yaml:"archiver_insecure"` - ArchiverPrefix string `yaml:"archiver_prefix"` - DatagatewayPrefix string `yaml:"data_gateway_prefix"` - Favorites bool `yaml:"favorites"` - ProjectSpaces bool `yaml:"project_spaces"` - OCSPrefix string `yaml:"ocs_prefix"` - OCSSharePrefix string `yaml:"ocs_share_prefix"` - OCSHomeNamespace string `yaml:"ocs_home_namespace"` - PublicURL string `yaml:"public_url"` - OCSCacheWarmupDriver string `yaml:"ocs_cache_warmup_driver"` - OCSAdditionalInfoAttribute string `yaml:"ocs_additional_info_attribute"` - OCSResourceInfoCacheTTL int `yaml:"ocs_resource_info_cache_ttl"` - Middleware Middleware `yaml:"middleware"` -} - -// Middleware configures reva middlewares. -type Middleware struct { - Auth Auth `yaml:"auth"` -} - -// Auth configures reva http auth middleware. -type Auth struct { - CredentialsByUserAgent map[string]string `yaml:"credentials_by_user_agenr"` -} - -// DataGatewayPort has a public url -type DataGatewayPort struct { - Port - PublicURL string -} - -type DataProvider struct { - Insecure bool `yaml:"insecure"` -} - -// StoragePort defines the available storage configuration. -type StoragePort struct { - Port - Driver string `yaml:"driver"` - MountID string `yaml:"mount_id"` - AlternativeID string `yaml:"alternative_id"` - ExposeDataServer bool `yaml:"expose_data_server"` - // url the data gateway will use to route requests - DataServerURL string `yaml:"data_server_url"` - - // for HTTP ports with only one http service - HTTPPrefix string `yaml:"http_prefix"` - TempFolder string `yaml:"temp_folder"` - ReadOnly bool `yaml:"read_only"` - DataProvider DataProvider `yaml:"data_provider"` - GatewayEndpoint string `yaml:"gateway_endpoint"` -} - -// PublicStorage configures a public storage provider -type PublicStorage struct { - StoragePort - - PublicShareProviderAddr string `yaml:"public_share_provider_addr"` - UserProviderAddr string `yaml:"user_provider_addr"` -} - -// StorageConfig combines all available storage driver configuration parts. -type StorageConfig struct { - EOS DriverEOS `yaml:"eos"` - Local DriverCommon `yaml:"local"` - OwnCloudSQL DriverOwnCloudSQL `yaml:"owncloud_sql"` - S3 DriverS3 `yaml:"s3"` - S3NG DriverS3NG `yaml:"s3ng"` - OCIS DriverOCIS `yaml:"ocis"` -} - -// DriverCommon defines common driver configuration options. -type DriverCommon struct { - // Root is the absolute path to the location of the data - Root string `yaml:"root"` - //ShareFolder defines the name of the folder jailing all shares - ShareFolder string `yaml:"share_folder"` - // UserLayout contains the template used to construct - // the internal path, eg: `{{substr 0 1 .Username}}/{{.Username}}` - UserLayout string `yaml:"user_layout"` - // EnableHome enables the creation of home directories. - EnableHome bool `yaml:"enable_home"` - // PersonalSpaceAliasTemplate contains the template used to construct - // the personal space alias, eg: `"{{.SpaceType}}/{{.User.Username | lower}}"` - PersonalSpaceAliasTemplate string `yaml:"personalspacealias_template"` - // GeneralSpaceAliasTemplate contains the template used to construct - // the general space alias, eg: `{{.SpaceType}}/{{.SpaceName | replace " " "-" | lower}}` - GeneralSpaceAliasTemplate string `yaml:"generalspacealias_template"` -} - -// DriverEOS defines the available EOS driver configuration. -type DriverEOS struct { - DriverCommon - - // ShadowNamespace for storing shadow data - ShadowNamespace string `yaml:"shadow_namespace"` - - // UploadsNamespace for storing upload data - UploadsNamespace string `yaml:"uploads_namespace"` - - // Location of the eos binary. - // Default is /usr/bin/eos. - EosBinary string `yaml:"eos_binary"` - - // Location of the xrdcopy binary. - // Default is /usr/bin/xrdcopy. - XrdcopyBinary string `yaml:"xrd_copy_binary"` - - // URL of the Master EOS MGM. - // Default is root://eos-example.org - MasterURL string `yaml:"master_url"` - - // URI of the EOS MGM grpc server - // Default is empty - GrpcURI string `yaml:"grpc_uri"` - - // URL of the Slave EOS MGM. - // Default is root://eos-example.org - SlaveURL string `yaml:"slave_url"` - - // Location on the local fs where to store reads. - // Defaults to os.TempDir() - CacheDirectory string `yaml:"cache_directory"` - - // Enables logging of the commands executed - // Defaults to false - EnableLogging bool `yaml:"enable_logging"` - - // ShowHiddenSysFiles shows internal EOS files like - // .sys.v# and .sys.a# files. - ShowHiddenSysFiles bool `yaml:"shadow_hidden_files"` - - // ForceSingleUserMode will force connections to EOS to use SingleUsername - ForceSingleUserMode bool `yaml:"force_single_user_mode"` - - // UseKeyTabAuth changes will authenticate requests by using an EOS keytab. - UseKeytab bool `yaml:"user_keytab"` - - // SecProtocol specifies the xrootd security protocol to use between the server and EOS. - SecProtocol string `yaml:"sec_protocol"` - - // Keytab specifies the location of the keytab to use to authenticate to EOS. - Keytab string `yaml:"keytab"` - - // SingleUsername is the username to use when SingleUserMode is enabled - SingleUsername string `yaml:"single_username"` - - // gateway service to use for uid lookups - GatewaySVC string `yaml:"gateway_svc"` -} - -// DriverOCIS defines the available oCIS storage driver configuration. -type DriverOCIS struct { - DriverCommon -} - -// DriverOwnCloudSQL defines the available ownCloudSQL storage driver configuration. -type DriverOwnCloudSQL struct { - DriverCommon - - UploadInfoDir string `yaml:"upload_info_dir"` - DBUsername string `yaml:"db_username"` - DBPassword string `yaml:"db_password"` - DBHost string `yaml:"db_host"` - DBPort int `yaml:"db_port"` - DBName string `yaml:"db_name"` -} - -// DriverS3 defines the available S3 storage driver configuration. -type DriverS3 struct { - DriverCommon - - Region string `yaml:"region"` - AccessKey string `yaml:"access_key"` - SecretKey string `yaml:"secret_key"` - Endpoint string `yaml:"endpoint"` - Bucket string `yaml:"bucket"` -} - -// DriverS3NG defines the available s3ng storage driver configuration. -type DriverS3NG struct { - DriverCommon - - Region string `yaml:"region"` - AccessKey string `yaml:"access_key"` - SecretKey string `yaml:"secret_key"` - Endpoint string `yaml:"endpoint"` - Bucket string `yaml:"bucket"` -} - -// OIDC defines the available OpenID Connect configuration. -type OIDC struct { - Issuer string `yaml:"issuer"` - Insecure bool `yaml:"insecure"` - IDClaim string `yaml:"id_claim"` - UIDClaim string `yaml:"uid_claim"` - GIDClaim string `yaml:"gid_claim"` -} - -// LDAP defines the available ldap configuration. -type LDAP struct { - URI string `yaml:"uri"` - CACert string `yaml:"ca_cert"` - Insecure bool `yaml:"insecure"` - UserBaseDN string `yaml:"user_base_dn"` - GroupBaseDN string `yaml:"group_base_dn"` - UserScope string `yaml:"user_scope"` - GroupScope string `yaml:"group_scope"` - UserObjectClass string `yaml:"user_objectclass"` - GroupObjectClass string `yaml:"group_objectclass"` - UserFilter string `yaml:"user_filter"` - GroupFilter string `yaml:"group_filter"` - LoginAttributes []string `yaml:"login_attributes"` - BindDN string `yaml:"bind_dn"` - BindPassword string `yaml:"bind_password"` - IDP string `yaml:"idp"` - UserSchema LDAPUserSchema `yaml:"user_schema"` - GroupSchema LDAPGroupSchema `yaml:"group_schema"` -} - -// UserGroupRest defines the REST driver specification for user and group resolution. -type UserGroupRest struct { - ClientID string `yaml:"client_id"` - ClientSecret string `yaml:"client_secret"` - RedisAddress string `yaml:"redis_address"` - RedisUsername string `yaml:"redis_username"` - RedisPassword string `yaml:"redis_password"` - IDProvider string `yaml:"idp_provider"` - APIBaseURL string `yaml:"api_base_url"` - OIDCTokenEndpoint string `yaml:"oidc_token_endpoint"` - TargetAPI string `yaml:"target_api"` -} - -// UserOwnCloudSQL defines the available ownCloudSQL user provider configuration. -type UserOwnCloudSQL struct { - DBUsername string `yaml:"db_username"` - DBPassword string `yaml:"db_password"` - DBHost string `yaml:"db_host"` - DBPort int `yaml:"db_port"` - DBName string `yaml:"db_name"` - Idp string `yaml:"idp"` - Nobody int64 `yaml:"nobody"` - JoinUsername bool `yaml:"join_username"` - JoinOwnCloudUUID bool `yaml:"join_owncloud_uuid"` - EnableMedialSearch bool `yaml:"enable_medial_search"` -} - -// LDAPUserSchema defines the available ldap user schema configuration. -type LDAPUserSchema struct { - ID string `yaml:"id"` - IDIsOctetString bool `yaml:"id_is_octet_string"` - Mail string `yaml:"mail"` - DisplayName string `yaml:"display_name"` - Username string `yaml:"user_name"` - UIDNumber string `yaml:"uid_number"` - GIDNumber string `yaml:"gid_number"` -} - -// LDAPGroupSchema defines the available ldap group schema configuration. -type LDAPGroupSchema struct { - ID string `yaml:"id"` - IDIsOctetString bool `yaml:"id_is_octet_string"` - Mail string `yaml:"mail"` - DisplayName string `yaml:"display_name"` - Groupname string `yaml:"group_name"` - Member string `yaml:"member"` - GIDNumber string `yaml:"gid_number"` -} - -// OCDav defines the available ocdav configuration. -type OCDav struct { - // Addr to listen to with the http server for the ocdav service - Addr string `yaml:"addr"` - Prefix string `yaml:"prefix"` - WebdavNamespace string `yaml:"webdav_namespace"` - FilesNamespace string `yaml:"files_namespace"` - SharesNamespace string `yaml:"shares_namespace"` - // PublicURL used to redirect /s/{token} URLs to - PublicURL string `yaml:"public_url"` - - // Addr to listen to with the debug http server - DebugAddr string `yaml:"debug_addr"` - - // GatewaySVC to forward CS3 requests to TODO use registry - GatewaySVC string `yaml:"gateway_svc"` - // JWTSecret used to verify reva access token - JWTSecret string `yaml:"jwt_secret"` - // Insecure certificates allowed when making requests to the gateway - Insecure bool `yaml:"insecure"` - // Timeout in seconds when making requests to the gateway - Timeout int64 `yaml:"timeout"` -} - -// Archiver defines the available archiver configuration. -type Archiver struct { - MaxNumFiles int64 `yaml:"max_num_files"` - MaxSize int64 `yaml:"max_size"` - ArchiverURL string `yaml:"archiver_url"` -} - -// Reva defines the available reva configuration. -type Reva struct { - // JWTSecret used to sign jwt tokens between services - JWTSecret string `yaml:"jwt_secret"` - SkipUserGroupsInToken bool `yaml:"skip_user_grooups_in_token"` - TransferSecret string `yaml:"transfer_secret"` - TransferExpires int `yaml:"transfer_expires"` - OIDC OIDC `yaml:"oidc"` - LDAP LDAP `yaml:"ldap"` - UserGroupRest UserGroupRest `yaml:"user_group_rest"` - UserOwnCloudSQL UserOwnCloudSQL `yaml:"user_owncloud_sql"` - Archiver Archiver `yaml:"archiver"` - UserStorage StorageConfig `yaml:"user_storage"` - MetadataStorage StorageConfig `yaml:"metadata_storage"` - // Ports are used to configure which services to start on which port - Frontend FrontendPort `yaml:"frontend"` - DataGateway DataGatewayPort `yaml:"data_gateway"` - Gateway Gateway `yaml:"gateway"` - StorageRegistry StorageRegistry `yaml:"storage_registry"` - AppRegistry AppRegistry `yaml:"app_registry"` - Users Users `yaml:"users"` - Groups Groups `yaml:"groups"` - AuthProvider Users `yaml:"auth_provider"` - AuthBasic Port `yaml:"auth_basic"` - AuthBearer Port `yaml:"auth_bearer"` - AuthMachine Port `yaml:"auth_machine"` - AuthMachineConfig AuthMachineConfig `yaml:"auth_machine_config"` - Sharing Sharing `yaml:"sharing"` - StorageShares StoragePort `yaml:"storage_shares"` - StorageUsers StoragePort `yaml:"storage_users"` - StoragePublicLink PublicStorage `yaml:"storage_public_link"` - StorageMetadata StoragePort `yaml:"storage_metadata"` - AppProvider AppProvider `yaml:"app_provider"` - Permissions Port `yaml:"permissions"` - // Configs can be used to configure the reva instance. - // Services and Ports will be ignored if this is used - Configs map[string]interface{} `yaml:"configs"` - // chunking and resumable upload config (TUS) - UploadMaxChunkSize int `yaml:"upload_max_chunk_size"` - UploadHTTPMethodOverride string `yaml:"upload_http_method_override"` - // checksumming capabilities - ChecksumSupportedTypes []string `yaml:"checksum_supported_types"` - ChecksumPreferredUploadType string `yaml:"checksum_preferred_upload_type"` - DefaultUploadProtocol string `yaml:"default_upload_protocol"` -} - -// Tracing defines the available tracing configuration. -type Tracing struct { - Enabled bool `yaml:"enabled"` - Type string `yaml:"type"` - Endpoint string `yaml:"endpoint"` - Collector string `yaml:"collector"` - Service string `yaml:"service"` -} - -// Asset defines the available asset configuration. -type Asset struct { - Path string `yaml:"path"` -} - -// Config combines all available configuration parts. -type Config struct { - *shared.Commons - - File string `yaml:"file"` - Log *shared.Log `yaml:"log"` - Debug Debug `yaml:"debug"` - OCDav OCDav `yaml:"ocdav"` - Reva Reva `yaml:"reva"` - Tracing Tracing `yaml:"tracing"` - Asset Asset `yaml:"asset"` -} - -// New initializes a new configuration with or without defaults. -func New() *Config { - return &Config{} -} - -// 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. -func StructMappings(cfg *Config) []shared.EnvBinding { - return structMappings(cfg) -} - -// GetEnv fetches a list of known env variables for this extension. It is to be used by gookit, as it provides a list -// with all the environment variables an extension supports. -func GetEnv(cfg *Config) []string { - var r = make([]string, len(structMappings(cfg))) - for i := range structMappings(cfg) { - r = append(r, structMappings(cfg)[i].EnvVars...) - } - - return r -} - -func structMappings(cfg *Config) []shared.EnvBinding { - return []shared.EnvBinding{ - // Shared - { - EnvVars: []string{"OCIS_LOG_LEVEL", "STORAGE_FRONTEND_LOG_LEVEL"}, - Destination: &cfg.Log.Level, - }, - { - EnvVars: []string{"OCIS_LOG_PRETTY", "STORAGE_FRONTEND_LOG_PRETTY"}, - Destination: &cfg.Log.Pretty, - }, - { - EnvVars: []string{"OCIS_LOG_COLOR", "STORAGE_FRONTEND_LOG_COLOR"}, - Destination: &cfg.Log.Color, - }, - { - EnvVars: []string{"OCIS_INSECURE", "STORAGE_METADATA_DATAPROVIDER_INSECURE"}, - Destination: &cfg.Reva.StorageMetadata.DataProvider.Insecure, - }, - { - EnvVars: []string{"OCIS_INSECURE", "STORAGE_FRONTEND_APPPROVIDER_INSECURE"}, - Destination: &cfg.Reva.Frontend.AppProviderInsecure, - }, - { - EnvVars: []string{"OCIS_INSECURE", "STORAGE_FRONTEND_ARCHIVER_INSECURE"}, - Destination: &cfg.Reva.Frontend.ArchiverInsecure, - }, - { - EnvVars: []string{"OCIS_INSECURE", "STORAGE_OIDC_INSECURE"}, - Destination: &cfg.Reva.OIDC.Insecure, - }, - { - EnvVars: []string{"OCIS_INSECURE", "STORAGE_USERS_DATAPROVIDER_INSECURE"}, - Destination: &cfg.Reva.StorageUsers.DataProvider.Insecure, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_LOCAL_ROOT"}, - Destination: &cfg.Reva.UserStorage.Local.Root, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER"}, - Destination: &cfg.Reva.StorageUsers.Driver, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_OCIS_ROOT"}, - Destination: &cfg.Reva.UserStorage.OCIS.Root, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_OCIS_ROOT"}, - Destination: &cfg.Reva.MetadataStorage.OCIS.Root, - }, - { - EnvVars: []string{"STORAGE_SHARING_USER_JSON_FILE"}, - Destination: &cfg.Reva.Sharing.UserJSONFile, - }, - { - EnvVars: []string{"OCIS_URL", "STORAGE_FRONTEND_PUBLIC_URL"}, - Destination: &cfg.Reva.Frontend.PublicURL, - }, - { - EnvVars: []string{"OCIS_URL", "STORAGE_OIDC_ISSUER"}, - Destination: &cfg.Reva.OIDC.Issuer, - }, - { - EnvVars: []string{"OCIS_URL", "STORAGE_LDAP_IDP"}, - Destination: &cfg.Reva.LDAP.IDP, - }, - { - EnvVars: []string{"OCIS_URL", "STORAGE_USERPROVIDER_OWNCLOUDSQL_IDP"}, - Destination: &cfg.Reva.UserOwnCloudSQL.Idp, - }, - { - EnvVars: []string{"STORAGE_DEBUG_ADDR"}, - Destination: &cfg.Debug.Addr, - }, - - // debug - - { - EnvVars: []string{"STORAGE_DEBUG_TOKEN"}, - Destination: &cfg.Debug.Token, - }, - { - EnvVars: []string{"STORAGE_DEBUG_PPROF"}, - Destination: &cfg.Debug.Pprof, - }, - { - EnvVars: []string{"STORAGE_DEBUG_ZPAGES"}, - Destination: &cfg.Debug.Zpages, - }, - - // app provider - - { - EnvVars: []string{"APP_PROVIDER_DEBUG_ADDR"}, - Destination: &cfg.Reva.AppProvider.DebugAddr, - }, - { - EnvVars: []string{"APP_PROVIDER_GRPC_NETWORK"}, - Destination: &cfg.Reva.AppProvider.GRPCNetwork, - }, - { - EnvVars: []string{"APP_PROVIDER_GRPC_ADDR"}, - Destination: &cfg.Reva.AppProvider.GRPCAddr, - }, - { - EnvVars: []string{"APP_PROVIDER_EXTERNAL_ADDR"}, - Destination: &cfg.Reva.AppProvider.ExternalAddr, - }, - { - EnvVars: []string{"APP_PROVIDER_DRIVER"}, - Destination: &cfg.Reva.AppProvider.Driver, - }, - { - EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_APP_API_KEY"}, - Destination: &cfg.Reva.AppProvider.WopiDriver.AppAPIKey, - }, - { - EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_APP_DESKTOP_ONLY"}, - Destination: &cfg.Reva.AppProvider.WopiDriver.AppDesktopOnly, - }, - { - EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_APP_ICON_URI"}, - Destination: &cfg.Reva.AppProvider.WopiDriver.AppIconURI, - }, - { - EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_APP_INTERNAL_URL"}, - Destination: &cfg.Reva.AppProvider.WopiDriver.AppInternalURL, - }, - { - EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_APP_NAME"}, - Destination: &cfg.Reva.AppProvider.WopiDriver.AppName, - }, - { - EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_APP_URL"}, - Destination: &cfg.Reva.AppProvider.WopiDriver.AppURL, - }, - { - EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_INSECURE"}, - Destination: &cfg.Reva.AppProvider.WopiDriver.Insecure, - }, - { - EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_IOP_SECRET"}, - Destination: &cfg.Reva.AppProvider.WopiDriver.IopSecret, - }, - { - EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_WOPI_URL"}, - Destination: &cfg.Reva.AppProvider.WopiDriver.WopiURL, - }, - - // authbasic - { - EnvVars: []string{"STORAGE_AUTH_BASIC_DEBUG_ADDR"}, - Destination: &cfg.Reva.AuthBasic.DebugAddr, - }, - { - EnvVars: []string{"STORAGE_AUTH_DRIVER"}, - Destination: &cfg.Reva.AuthProvider.Driver, - }, - { - EnvVars: []string{"STORAGE_AUTH_JSON"}, - Destination: &cfg.Reva.AuthProvider.JSON, - }, - { - EnvVars: []string{"STORAGE_AUTH_BASIC_GRPC_NETWORK"}, - Destination: &cfg.Reva.AuthBasic.GRPCNetwork, - }, - { - EnvVars: []string{"STORAGE_AUTH_BASIC_GRPC_ADDR"}, - Destination: &cfg.Reva.AuthBasic.GRPCAddr, - }, - { - EnvVars: []string{"REVA_GATEWAY"}, - Destination: &cfg.Reva.Gateway.Endpoint, - }, - - // authbearer - { - EnvVars: []string{"STORAGE_AUTH_BEARER_DEBUG_ADDR"}, - Destination: &cfg.Reva.AuthBearer.DebugAddr, - }, - { - EnvVars: []string{"STORAGE_OIDC_ID_CLAIM"}, - Destination: &cfg.Reva.OIDC.IDClaim, - }, - { - EnvVars: []string{"STORAGE_OIDC_UID_CLAIM"}, - Destination: &cfg.Reva.OIDC.UIDClaim, - }, - { - EnvVars: []string{"STORAGE_OIDC_GID_CLAIM"}, - Destination: &cfg.Reva.OIDC.GIDClaim, - }, - { - EnvVars: []string{"STORAGE_AUTH_BEARER_GRPC_NETWORK"}, - Destination: &cfg.Reva.AuthBearer.GRPCNetwork, - }, - { - EnvVars: []string{"STORAGE_AUTH_BEARER_GRPC_ADDR"}, - Destination: &cfg.Reva.AuthBearer.GRPCAddr, - }, - - // auth-machine - { - EnvVars: []string{"STORAGE_AUTH_MACHINE_DEBUG_ADDR"}, - Destination: &cfg.Reva.AuthMachine.DebugAddr, - }, - { - EnvVars: []string{"OCIS_MACHINE_AUTH_API_KEY", "STORAGE_AUTH_MACHINE_AUTH_API_KEY"}, - Destination: &cfg.Reva.AuthMachineConfig.MachineAuthAPIKey, - }, - { - EnvVars: []string{"STORAGE_AUTH_MACHINE_GRPC_NETWORK"}, - Destination: &cfg.Reva.AuthMachine.GRPCNetwork, - }, - { - EnvVars: []string{"STORAGE_AUTH_MACHINE_GRPC_ADDR"}, - Destination: &cfg.Reva.AuthMachine.GRPCAddr, - }, - - // frontend - { - EnvVars: []string{"STORAGE_FRONTEND_DEBUG_ADDR"}, - Destination: &cfg.Reva.Frontend.DebugAddr, - }, - { - EnvVars: []string{"STORAGE_TRANSFER_SECRET"}, - Destination: &cfg.Reva.TransferSecret, - }, - { - EnvVars: []string{"STORAGE_ARCHIVER_MAX_NUM_FILES"}, - Destination: &cfg.Reva.Archiver.MaxNumFiles, - }, - { - EnvVars: []string{"STORAGE_ARCHIVER_MAX_SIZE"}, - Destination: &cfg.Reva.Archiver.MaxSize, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_HTTP_NETWORK"}, - Destination: &cfg.Reva.Frontend.HTTPNetwork, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_HTTP_ADDR"}, - Destination: &cfg.Reva.Frontend.HTTPAddr, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_APPPROVIDER_PREFIX"}, - Destination: &cfg.Reva.Frontend.AppProviderPrefix, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_ARCHIVER_PREFIX"}, - Destination: &cfg.Reva.Frontend.ArchiverPrefix, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_DATAGATEWAY_PREFIX"}, - Destination: &cfg.Reva.Frontend.DatagatewayPrefix, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_FAVORITES"}, - Destination: &cfg.Reva.Frontend.Favorites, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_PROJECT_SPACES"}, - Destination: &cfg.Reva.Frontend.ProjectSpaces, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_OCS_PREFIX"}, - Destination: &cfg.Reva.Frontend.OCSPrefix, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_OCS_SHARE_PREFIX"}, - Destination: &cfg.Reva.Frontend.OCSSharePrefix, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_OCS_HOME_NAMESPACE"}, - Destination: &cfg.Reva.Frontend.OCSHomeNamespace, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_OCS_RESOURCE_INFO_CACHE_TTL"}, - Destination: &cfg.Reva.Frontend.OCSResourceInfoCacheTTL, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_OCS_CACHE_WARMUP_DRIVER"}, - Destination: &cfg.Reva.Frontend.OCSCacheWarmupDriver, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_OCS_ADDITIONAL_INFO_ATTRIBUTE"}, - Destination: &cfg.Reva.Frontend.OCSAdditionalInfoAttribute, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_DEFAULT_UPLOAD_PROTOCOL"}, - Destination: &cfg.Reva.DefaultUploadProtocol, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_UPLOAD_MAX_CHUNK_SIZE"}, - Destination: &cfg.Reva.UploadMaxChunkSize, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_UPLOAD_HTTP_METHOD_OVERRIDE"}, - Destination: &cfg.Reva.UploadHTTPMethodOverride, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_CHECKSUM_PREFERRED_UPLOAD_TYPE"}, - Destination: &cfg.Reva.ChecksumPreferredUploadType, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_ARCHIVER_URL"}, - Destination: &cfg.Reva.Archiver.ArchiverURL, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_APP_PROVIDER_APPS_URL"}, - Destination: &cfg.Reva.AppProvider.AppsURL, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_APP_PROVIDER_OPEN_URL"}, - Destination: &cfg.Reva.AppProvider.OpenURL, - }, - { - EnvVars: []string{"STORAGE_FRONTEND_APP_PROVIDER_NEW_URL"}, - Destination: &cfg.Reva.AppProvider.NewURL, - }, - - // gateway - { - EnvVars: []string{"STORAGE_GATEWAY_DEBUG_ADDR"}, - Destination: &cfg.Reva.Gateway.DebugAddr, - }, - { - EnvVars: []string{"STORAGE_TRANSFER_EXPIRES"}, - Destination: &cfg.Reva.TransferExpires, - }, - { - EnvVars: []string{"STORAGE_GATEWAY_GRPC_NETWORK"}, - Destination: &cfg.Reva.Gateway.GRPCNetwork, - }, - { - EnvVars: []string{"STORAGE_GATEWAY_GRPC_ADDR"}, - Destination: &cfg.Reva.Gateway.GRPCAddr, - }, - - { - EnvVars: []string{"STORAGE_GATEWAY_COMMIT_SHARE_TO_STORAGE_GRANT"}, - Destination: &cfg.Reva.Gateway.CommitShareToStorageGrant, - }, - { - EnvVars: []string{"STORAGE_GATEWAY_COMMIT_SHARE_TO_STORAGE_REF"}, - Destination: &cfg.Reva.Gateway.CommitShareToStorageRef, - }, - { - EnvVars: []string{"STORAGE_GATEWAY_SHARE_FOLDER"}, - Destination: &cfg.Reva.Gateway.ShareFolder, - }, - { - EnvVars: []string{"STORAGE_GATEWAY_DISABLE_HOME_CREATION_ON_LOGIN"}, - Destination: &cfg.Reva.Gateway.DisableHomeCreationOnLogin, - }, - { - EnvVars: []string{"STORAGE_GATEWAY_HOME_MAPPING"}, - Destination: &cfg.Reva.Gateway.HomeMapping, - }, - { - EnvVars: []string{"STORAGE_GATEWAY_ETAG_CACHE_TTL"}, - Destination: &cfg.Reva.Gateway.EtagCacheTTL, - }, - { - EnvVars: []string{"STORAGE_AUTH_BASIC_ENDPOINT"}, - Destination: &cfg.Reva.AuthBasic.Endpoint, - }, - { - EnvVars: []string{"STORAGE_AUTH_BEARER_ENDPOINT"}, - Destination: &cfg.Reva.AuthBearer.Endpoint, - }, - { - EnvVars: []string{"STORAGE_AUTH_MACHINE_ENDPOINT"}, - Destination: &cfg.Reva.AuthMachine.Endpoint, - }, - { - EnvVars: []string{"STORAGE_STORAGE_REGISTRY_DRIVER"}, - Destination: &cfg.Reva.StorageRegistry.Driver, - }, - { - EnvVars: []string{"STORAGE_STORAGE_REGISTRY_HOME_PROVIDER"}, - Destination: &cfg.Reva.StorageRegistry.HomeProvider, - }, - { - EnvVars: []string{"STORAGE_STORAGE_REGISTRY_JSON"}, - Destination: &cfg.Reva.StorageRegistry.JSON, - }, - { - EnvVars: []string{"STORAGE_APP_REGISTRY_DRIVER"}, - Destination: &cfg.Reva.AppRegistry.Driver, - }, - { - EnvVars: []string{"STORAGE_APP_REGISTRY_MIMETYPES_JSON"}, - Destination: &cfg.Reva.AppRegistry.MimetypesJSON, - }, - { - EnvVars: []string{"STORAGE_DATAGATEWAY_PUBLIC_URL"}, - Destination: &cfg.Reva.DataGateway.PublicURL, - }, - { - EnvVars: []string{"STORAGE_USERPROVIDER_ENDPOINT"}, - Destination: &cfg.Reva.Users.Endpoint, - }, - { - EnvVars: []string{"STORAGE_GROUPPROVIDER_ENDPOINT"}, - Destination: &cfg.Reva.Groups.Endpoint, - }, - { - EnvVars: []string{"STORAGE_SHARING_ENDPOINT"}, - Destination: &cfg.Reva.Sharing.Endpoint, - }, - { - EnvVars: []string{"STORAGE_APPPROVIDER_ENDPOINT"}, - Destination: &cfg.Reva.AppProvider.Endpoint, - }, - { - EnvVars: []string{"STORAGE_USERS_ENDPOINT"}, - Destination: &cfg.Reva.StorageUsers.Endpoint, - }, - { - EnvVars: []string{"STORAGE_USERS_MOUNT_ID"}, - Destination: &cfg.Reva.StorageUsers.MountID, - }, - { - EnvVars: []string{"STORAGE_SHARES_ENDPOINT"}, - Destination: &cfg.Reva.StorageShares.Endpoint, - }, - { - EnvVars: []string{"STORAGE_PUBLIC_LINK_ENDPOINT"}, - Destination: &cfg.Reva.StoragePublicLink.Endpoint, - }, - - // groups - { - EnvVars: []string{"STORAGE_GROUPPROVIDER_DEBUG_ADDR"}, - Destination: &cfg.Reva.Groups.DebugAddr, - }, - { - EnvVars: []string{"STORAGE_GROUPPROVIDER_NETWORK"}, - Destination: &cfg.Reva.Groups.GRPCNetwork, - }, - { - EnvVars: []string{"STORAGE_GROUPPROVIDER_ADDR"}, - Destination: &cfg.Reva.Groups.GRPCAddr, - }, - { - EnvVars: []string{"STORAGE_GROUPPROVIDER_DRIVER"}, - Destination: &cfg.Reva.Groups.Driver, - }, - { - EnvVars: []string{"STORAGE_GROUPPROVIDER_JSON"}, - Destination: &cfg.Reva.Groups.JSON, - }, - { - EnvVars: []string{"STORAGE_GROUP_CACHE_EXPIRATION"}, - Destination: &cfg.Reva.Groups.GroupMembersCacheExpiration, - }, - - // ldap - { - EnvVars: []string{"LDAP_URI", "STORAGE_LDAP_URI"}, - Destination: &cfg.Reva.LDAP.URI, - }, - { - EnvVars: []string{"LDAP_CACERT", "STORAGE_LDAP_CACERT"}, - Destination: &cfg.Reva.LDAP.CACert, - }, - { - EnvVars: []string{"LDAP_INSECURE", "STORAGE_LDAP_INSECURE"}, - Destination: &cfg.Reva.LDAP.Insecure, - }, - { - EnvVars: []string{"LDAP_USER_BASE_DN", "STORAGE_LDAP_USER_BASE_DN"}, - Destination: &cfg.Reva.LDAP.UserBaseDN, - }, - { - EnvVars: []string{"LDAP_GROUP_BASE_DN", "STORAGE_LDAP_GROUP_BASE_DN"}, - Destination: &cfg.Reva.LDAP.GroupBaseDN, - }, - { - EnvVars: []string{"LDAP_USER_SCOPE", "STORAGE_LDAP_USER_SCOPE"}, - Destination: &cfg.Reva.LDAP.UserScope, - }, - { - EnvVars: []string{"LDAP_GROUP_SCOPE", "STORAGE_LDAP_GROUP_SCOPE"}, - Destination: &cfg.Reva.LDAP.GroupScope, - }, - { - EnvVars: []string{"LDAP_USER_OBJECTCLASS", "STORAGE_LDAP_USER_OBJECTCLASS"}, - Destination: &cfg.Reva.LDAP.UserObjectClass, - }, - { - EnvVars: []string{"LDAP_GROUP_OBJECTCLASS", "STORAGE_LDAP_GROUP_OBJECTCLASS"}, - Destination: &cfg.Reva.LDAP.GroupObjectClass, - }, - { - EnvVars: []string{"LDAP_LOGIN_ATTRIBUTES", "STORAGE_LDAP_LOGIN_ATTRIBUTES"}, - Destination: &cfg.Reva.LDAP.LoginAttributes, - }, - { - EnvVars: []string{"LDAP_USERFILTER", "STORAGE_LDAP_USERFILTER"}, - Destination: &cfg.Reva.LDAP.UserFilter, - }, - { - EnvVars: []string{"LDAP_GROUPFILTER", "STORAGE_LDAP_GROUPFILTER"}, - Destination: &cfg.Reva.LDAP.GroupFilter, - }, - { - EnvVars: []string{"LDAP_BIND_DN", "STORAGE_LDAP_BIND_DN"}, - Destination: &cfg.Reva.LDAP.BindDN, - }, - { - EnvVars: []string{"LDAP_BIND_PASSWORD", "STORAGE_LDAP_BIND_PASSWORD"}, - Destination: &cfg.Reva.LDAP.BindPassword, - }, - { - EnvVars: []string{"LDAP_USER_SCHEMA_ID", "STORAGE_LDAP_USER_SCHEMA_ID"}, - Destination: &cfg.Reva.LDAP.UserSchema.ID, - }, - { - EnvVars: []string{"LDAP_USER_SCHEMA_ID_IS_OCTETSTRING", "STORAGE_LDAP_USER_SCHEMA_ID_IS_OCTETSTRING"}, - Destination: &cfg.Reva.LDAP.UserSchema.IDIsOctetString, - }, - { - EnvVars: []string{"LDAP_USER_SCHEMA_MAIL", "STORAGE_LDAP_USER_SCHEMA_MAIL"}, - Destination: &cfg.Reva.LDAP.UserSchema.Mail, - }, - { - EnvVars: []string{"LDAP_USER_SCHEMA_DISPLAYNAME", "STORAGE_LDAP_USER_SCHEMA_DISPLAYNAME"}, - Destination: &cfg.Reva.LDAP.UserSchema.DisplayName, - }, - { - EnvVars: []string{"LDAP_USER_SCHEMA_USERNAME", "STORAGE_LDAP_USER_SCHEMA_USERNAME"}, - Destination: &cfg.Reva.LDAP.UserSchema.Username, - }, - { - EnvVars: []string{"LDAP_USER_SCHEMA_UID_NUMBER", "STORAGE_LDAP_USER_SCHEMA_UID_NUMBER"}, - Destination: &cfg.Reva.LDAP.UserSchema.UIDNumber, - }, - { - EnvVars: []string{"LDAP_USER_SCHEMA_GID_NUMBER", "STORAGE_LDAP_USER_SCHEMA_GID_NUMBER"}, - Destination: &cfg.Reva.LDAP.UserSchema.GIDNumber, - }, - { - EnvVars: []string{"LDAP_GROUP_SCHEMA_ID", "STORAGE_LDAP_GROUP_SCHEMA_ID"}, - Destination: &cfg.Reva.LDAP.GroupSchema.ID, - }, - { - EnvVars: []string{"LDAP_GROUP_SCHEMA_ID_IS_OCTETSTRING", "STORAGE_LDAP_GROUP_SCHEMA_ID_IS_OCTETSTRING"}, - Destination: &cfg.Reva.LDAP.GroupSchema.IDIsOctetString, - }, - { - EnvVars: []string{"LDAP_GROUP_SCHEMA_MAIL", "STORAGE_LDAP_GROUP_SCHEMA_MAIL"}, - Destination: &cfg.Reva.LDAP.GroupSchema.Mail, - }, - { - EnvVars: []string{"LDAP_GROUP_SCHEMA_DISPLAYNAME", "STORAGE_LDAP_GROUP_SCHEMA_DISPLAYNAME"}, - Destination: &cfg.Reva.LDAP.GroupSchema.DisplayName, - }, - { - EnvVars: []string{"LDAP_GROUP_SCHEMA_GROUPNAME", "STORAGE_LDAP_GROUP_SCHEMA_GROUPNAME"}, - Destination: &cfg.Reva.LDAP.GroupSchema.Groupname, - }, - { - EnvVars: []string{"LDAP_GROUP_SCHEMA_MEMBER", "STORAGE_LDAP_GROUP_SCHEMA_MEMBER"}, - Destination: &cfg.Reva.LDAP.GroupSchema.Member, - }, - { - EnvVars: []string{"LDAP_GROUP_SCHEMA_GID_NUMBER", "STORAGE_LDAP_GROUP_SCHEMA_GID_NUMBER"}, - Destination: &cfg.Reva.LDAP.GroupSchema.GIDNumber, - }, - - // rest - { - EnvVars: []string{"STORAGE_REST_CLIENT_ID"}, - Destination: &cfg.Reva.UserGroupRest.ClientID, - }, - { - EnvVars: []string{"STORAGE_REST_CLIENT_SECRET"}, - Destination: &cfg.Reva.UserGroupRest.ClientSecret, - }, - { - EnvVars: []string{"STORAGE_REST_REDIS_ADDRESS"}, - Destination: &cfg.Reva.UserGroupRest.RedisAddress, - }, - { - EnvVars: []string{"STORAGE_REST_REDIS_USERNAME"}, - Destination: &cfg.Reva.UserGroupRest.RedisUsername, - }, - { - EnvVars: []string{"STORAGE_REST_REDIS_PASSWORD"}, - Destination: &cfg.Reva.UserGroupRest.RedisPassword, - }, - { - EnvVars: []string{"STORAGE_REST_ID_PROVIDER"}, - Destination: &cfg.Reva.UserGroupRest.IDProvider, - }, - { - EnvVars: []string{"STORAGE_REST_API_BASE_URL"}, - Destination: &cfg.Reva.UserGroupRest.APIBaseURL, - }, - { - EnvVars: []string{"STORAGE_REST_OIDC_TOKEN_ENDPOINT"}, - Destination: &cfg.Reva.UserGroupRest.OIDCTokenEndpoint, - }, - { - EnvVars: []string{"STORAGE_REST_TARGET_API"}, - Destination: &cfg.Reva.UserGroupRest.TargetAPI, - }, - - // secret - { - EnvVars: []string{"OCIS_JWT_SECRET", "STORAGE_JWT_SECRET"}, - Destination: &cfg.Reva.JWTSecret, - }, - { - EnvVars: []string{"STORAGE_SKIP_USER_GROUPS_IN_TOKEN"}, - Destination: &cfg.Reva.SkipUserGroupsInToken, - }, - - // sharing - { - EnvVars: []string{"STORAGE_SHARING_DEBUG_ADDR"}, - Destination: &cfg.Reva.Sharing.DebugAddr, - }, - { - EnvVars: []string{"STORAGE_SHARING_GRPC_NETWORK"}, - Destination: &cfg.Reva.Sharing.GRPCNetwork, - }, - { - EnvVars: []string{"STORAGE_SHARING_GRPC_ADDR"}, - Destination: &cfg.Reva.Sharing.GRPCAddr, - }, - { - EnvVars: []string{"STORAGE_SHARING_USER_DRIVER"}, - Destination: &cfg.Reva.Sharing.UserDriver, - }, - { - EnvVars: []string{"STORAGE_SHARING_PUBLIC_DRIVER"}, - Destination: &cfg.Reva.Sharing.PublicDriver, - }, - { - EnvVars: []string{"STORAGE_SHARING_PUBLIC_JSON_FILE"}, - Destination: &cfg.Reva.Sharing.PublicJSONFile, - }, - { - EnvVars: []string{"STORAGE_SHARING_PUBLIC_PASSWORD_HASH_COST"}, - Destination: &cfg.Reva.Sharing.PublicPasswordHashCost, - }, - { - EnvVars: []string{"STORAGE_SHARING_PUBLIC_ENABLE_EXPIRED_SHARES_CLEANUP"}, - Destination: &cfg.Reva.Sharing.PublicEnableExpiredSharesCleanup, - }, - { - EnvVars: []string{"STORAGE_SHARING_PUBLIC_JANITOR_RUN_INTERVAL"}, - Destination: &cfg.Reva.Sharing.PublicJanitorRunInterval, - }, - - // sharing cs3 - - { - EnvVars: []string{"STORAGE_SHARING_CS3_PROVIDER_ADDR"}, - Destination: &cfg.Reva.Sharing.CS3ProviderAddr, - }, - { - EnvVars: []string{"STORAGE_SHARING_CS3_SERVICE_USER"}, - Destination: &cfg.Reva.Sharing.CS3ServiceUser, - }, - { - EnvVars: []string{"OCIS_URL", "STORAGE_SHARING_CS3_SERVICE_USER_IDP"}, - Destination: &cfg.Reva.Sharing.CS3ServiceUserIdp, - }, - - // sharingsql - { - EnvVars: []string{"STORAGE_SHARING_USER_SQL_USERNAME"}, - Destination: &cfg.Reva.Sharing.UserSQLUsername, - }, - { - EnvVars: []string{"STORAGE_SHARING_USER_SQL_PASSWORD"}, - Destination: &cfg.Reva.Sharing.UserSQLPassword, - }, - { - EnvVars: []string{"STORAGE_SHARING_USER_SQL_HOST"}, - Destination: &cfg.Reva.Sharing.UserSQLHost, - }, - { - EnvVars: []string{"STORAGE_SHARING_USER_SQL_PORT"}, - Destination: &cfg.Reva.Sharing.UserSQLPort, - }, - { - EnvVars: []string{"STORAGE_SHARING_USER_SQL_NAME"}, - Destination: &cfg.Reva.Sharing.UserSQLName, - }, - { - EnvVars: []string{"STORAGE_SHARING_EVENTS_ADDRESS"}, - Destination: &cfg.Reva.Sharing.Events.Address, - }, - { - EnvVars: []string{"STORAGE_SHARING_EVENTS_CLUSTER_ID"}, - Destination: &cfg.Reva.Sharing.Events.ClusterID, - }, - - // storage metadata - { - EnvVars: []string{"STORAGE_METADATA_DEBUG_ADDR"}, - Destination: &cfg.Reva.StorageMetadata.DebugAddr, - }, - { - EnvVars: []string{"STORAGE_METADATA_GRPC_NETWORK"}, - Destination: &cfg.Reva.StorageMetadata.GRPCNetwork, - }, - { - EnvVars: []string{"STORAGE_METADATA_GRPC_ADDR"}, - Destination: &cfg.Reva.StorageMetadata.GRPCAddr, - }, - { - EnvVars: []string{"STORAGE_METADATA_DATA_SERVER_URL"}, - Destination: &cfg.Reva.StorageMetadata.DataServerURL, - }, - { - EnvVars: []string{"STORAGE_METADATA_HTTP_NETWORK"}, - Destination: &cfg.Reva.StorageMetadata.HTTPNetwork, - }, - { - EnvVars: []string{"STORAGE_METADATA_HTTP_ADDR"}, - Destination: &cfg.Reva.StorageMetadata.HTTPAddr, - }, - { - EnvVars: []string{"STORAGE_METADATA_TMP_FOLDER"}, - Destination: &cfg.Reva.StorageMetadata.TempFolder, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER"}, - Destination: &cfg.Reva.StorageMetadata.Driver, - }, - - // storage public link - { - EnvVars: []string{"STORAGE_PUBLIC_LINK_DEBUG_ADDR"}, - Destination: &cfg.Reva.StoragePublicLink.DebugAddr, - }, - { - EnvVars: []string{"STORAGE_PUBLIC_LINK_GRPC_NETWORK"}, - Destination: &cfg.Reva.StoragePublicLink.GRPCNetwork, - }, - { - EnvVars: []string{"STORAGE_PUBLIC_LINK_GRPC_ADDR"}, - Destination: &cfg.Reva.StoragePublicLink.GRPCAddr, - }, - - // storage users - { - EnvVars: []string{"STORAGE_USERS_DEBUG_ADDR"}, - Destination: &cfg.Reva.StorageUsers.DebugAddr, - }, - { - EnvVars: []string{"STORAGE_USERS_GRPC_NETWORK"}, - Destination: &cfg.Reva.StorageUsers.GRPCNetwork, - }, - { - EnvVars: []string{"STORAGE_USERS_GRPC_ADDR"}, - Destination: &cfg.Reva.StorageUsers.GRPCAddr, - }, - { - EnvVars: []string{"STORAGE_USERS_HTTP_NETWORK"}, - Destination: &cfg.Reva.StorageUsers.HTTPNetwork, - }, - { - EnvVars: []string{"STORAGE_USERS_HTTP_ADDR"}, - Destination: &cfg.Reva.StorageUsers.HTTPAddr, - }, - { - EnvVars: []string{"OCIS_STORAGE_READ_ONLY", "STORAGE_USERS_READ_ONLY"}, - Destination: &cfg.Reva.StorageUsers.ReadOnly, - }, - { - EnvVars: []string{"STORAGE_USERS_EXPOSE_DATA_SERVER"}, - Destination: &cfg.Reva.StorageUsers.ExposeDataServer, - }, - { - EnvVars: []string{"STORAGE_USERS_DATA_SERVER_URL"}, - Destination: &cfg.Reva.StorageUsers.DataServerURL, - }, - { - EnvVars: []string{"STORAGE_USERS_HTTP_PREFIX"}, - Destination: &cfg.Reva.StorageUsers.HTTPPrefix, - }, - { - EnvVars: []string{"STORAGE_USERS_TMP_FOLDER"}, - Destination: &cfg.Reva.StorageUsers.TempFolder, - }, - - // storage shares - { - EnvVars: []string{"STORAGE_SHARES_DEBUG_ADDR"}, - Destination: &cfg.Reva.StorageShares.DebugAddr, - }, - { - EnvVars: []string{"STORAGE_SHARES_GRPC_NETWORK"}, - Destination: &cfg.Reva.StorageShares.GRPCNetwork, - }, - { - EnvVars: []string{"STORAGE_SHARES_GRPC_ADDR"}, - Destination: &cfg.Reva.StorageShares.GRPCAddr, - }, - { - EnvVars: []string{"STORAGE_SHARES_HTTP_NETWORK"}, - Destination: &cfg.Reva.StorageShares.HTTPNetwork, - }, - { - EnvVars: []string{"STORAGE_SHARES_HTTP_ADDR"}, - Destination: &cfg.Reva.StorageShares.HTTPAddr, - }, - { - EnvVars: []string{"OCIS_STORAGE_READ_ONLY", "STORAGE_SHARES_READ_ONLY"}, - Destination: &cfg.Reva.StorageShares.ReadOnly, - }, - - // tracing - { - EnvVars: []string{"OCIS_TRACING_ENABLED", "STORAGE_TRACING_ENABLED"}, - Destination: &cfg.Tracing.Enabled, - }, - { - EnvVars: []string{"OCIS_TRACING_TYPE", "STORAGE_TRACING_TYPE"}, - Destination: &cfg.Tracing.Type, - }, - { - EnvVars: []string{"OCIS_TRACING_ENDPOINT", "STORAGE_TRACING_ENDPOINT"}, - Destination: &cfg.Tracing.Endpoint, - }, - { - EnvVars: []string{"OCIS_TRACING_COLLECTOR", "STORAGE_TRACING_COLLECTOR"}, - Destination: &cfg.Tracing.Collector, - }, - { - EnvVars: []string{"STORAGE_TRACING_SERVICE"}, - Destination: &cfg.Tracing.Service, - }, - - // users - { - EnvVars: []string{"STORAGE_USERPROVIDER_DEBUG_ADDR"}, - Destination: &cfg.Reva.Users.DebugAddr, - }, - { - EnvVars: []string{"STORAGE_USERPROVIDER_NETWORK"}, - Destination: &cfg.Reva.Users.GRPCNetwork, - }, - { - EnvVars: []string{"STORAGE_USERPROVIDER_ADDR"}, - Destination: &cfg.Reva.Users.GRPCAddr, - }, - { - EnvVars: []string{"STORAGE_USERPROVIDER_DRIVER"}, - Destination: &cfg.Reva.Users.Driver, - }, - { - EnvVars: []string{"STORAGE_USERPROVIDER_JSON"}, - Destination: &cfg.Reva.Users.JSON, - }, - { - EnvVars: []string{"STORAGE_USER_CACHE_EXPIRATION"}, - Destination: &cfg.Reva.Users.UserGroupsCacheExpiration, - }, - { - EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_DBHOST"}, - Destination: &cfg.Reva.UserOwnCloudSQL.DBHost, - }, - { - EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_DBPORT"}, - Destination: &cfg.Reva.UserOwnCloudSQL.DBPort, - }, - { - EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_DBNAME"}, - Destination: &cfg.Reva.UserOwnCloudSQL.DBName, - }, - { - EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_DBUSER"}, - Destination: &cfg.Reva.UserOwnCloudSQL.DBUsername, - }, - { - EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_DBPASS"}, - Destination: &cfg.Reva.UserOwnCloudSQL.DBPassword, - }, - { - EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_NOBODY"}, - Destination: &cfg.Reva.UserOwnCloudSQL.Nobody, - }, - { - EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_JOIN_USERNAME"}, - Destination: &cfg.Reva.UserOwnCloudSQL.JoinUsername, - }, - { - EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_JOIN_OWNCLOUDUUID"}, - Destination: &cfg.Reva.UserOwnCloudSQL.JoinOwnCloudUUID, - }, - { - EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_ENABLE_MEDIAL_SEARCH"}, - Destination: &cfg.Reva.UserOwnCloudSQL.EnableMedialSearch, - }, - - // driver eos - { - EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_NAMESPACE"}, - Destination: &cfg.Reva.UserStorage.EOS.Root, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SHADOW_NAMESPACE"}, - Destination: &cfg.Reva.UserStorage.EOS.ShadowNamespace, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_UPLOADS_NAMESPACE"}, - Destination: &cfg.Reva.UserStorage.EOS.UploadsNamespace, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SHARE_FOLDER"}, - Destination: &cfg.Reva.UserStorage.EOS.ShareFolder, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_BINARY"}, - Destination: &cfg.Reva.UserStorage.EOS.EosBinary, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_XRDCOPY_BINARY"}, - Destination: &cfg.Reva.UserStorage.EOS.XrdcopyBinary, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_MASTER_URL"}, - Destination: &cfg.Reva.UserStorage.EOS.MasterURL, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SLAVE_URL"}, - Destination: &cfg.Reva.UserStorage.EOS.SlaveURL, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_CACHE_DIRECTORY"}, - Destination: &cfg.Reva.UserStorage.EOS.CacheDirectory, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_ENABLE_LOGGING"}, - Destination: &cfg.Reva.UserStorage.EOS.EnableLogging, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SHOW_HIDDEN_SYSFILES"}, - Destination: &cfg.Reva.UserStorage.EOS.ShowHiddenSysFiles, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_FORCE_SINGLEUSER_MODE"}, - Destination: &cfg.Reva.UserStorage.EOS.ForceSingleUserMode, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_USE_KEYTAB"}, - Destination: &cfg.Reva.UserStorage.EOS.UseKeytab, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SEC_PROTOCOL"}, - Destination: &cfg.Reva.UserStorage.EOS.SecProtocol, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_KEYTAB"}, - Destination: &cfg.Reva.UserStorage.EOS.Keytab, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SINGLE_USERNAME"}, - Destination: &cfg.Reva.UserStorage.EOS.SingleUsername, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_LAYOUT"}, - Destination: &cfg.Reva.UserStorage.EOS.UserLayout, - }, - { - EnvVars: []string{"REVA_GATEWAY"}, - Destination: &cfg.Reva.UserStorage.EOS.GatewaySVC, - }, - - // driver local - { - EnvVars: []string{"STORAGE_USERS_DRIVER_LOCAL_SHARE_FOLDER"}, - Destination: &cfg.Reva.UserStorage.Local.ShareFolder, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_LOCAL_USER_LAYOUT"}, - Destination: &cfg.Reva.UserStorage.Local.UserLayout, - }, - - // driver ocis - { - EnvVars: []string{"STORAGE_USERS_DRIVER_OCIS_LAYOUT"}, - Destination: &cfg.Reva.UserStorage.OCIS.UserLayout, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_OCIS_SHARE_FOLDER"}, - Destination: &cfg.Reva.UserStorage.OCIS.ShareFolder, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_OCIS_PERSONAL_SPACE_ALIAS_TEMPLATE"}, - Destination: &cfg.Reva.UserStorage.OCIS.PersonalSpaceAliasTemplate, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_OCIS_GENERAL_SPACE_ALIAS_TEMPLATE"}, - Destination: &cfg.Reva.UserStorage.OCIS.GeneralSpaceAliasTemplate, - }, - // driver owncloud sql - { - EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DATADIR"}, - Destination: &cfg.Reva.UserStorage.OwnCloudSQL.Root, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_UPLOADINFO_DIR"}, - Destination: &cfg.Reva.UserStorage.OwnCloudSQL.UploadInfoDir, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_SHARE_FOLDER"}, - Destination: &cfg.Reva.UserStorage.OwnCloudSQL.ShareFolder, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_LAYOUT"}, - Destination: &cfg.Reva.UserStorage.OwnCloudSQL.UserLayout, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DBUSERNAME"}, - Destination: &cfg.Reva.UserStorage.OwnCloudSQL.DBUsername, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DBPASSWORD"}, - Destination: &cfg.Reva.UserStorage.OwnCloudSQL.DBPassword, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DBHOST"}, - Destination: &cfg.Reva.UserStorage.OwnCloudSQL.DBHost, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DBPORT"}, - Destination: &cfg.Reva.UserStorage.OwnCloudSQL.DBPort, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DBNAME"}, - Destination: &cfg.Reva.UserStorage.OwnCloudSQL.DBName, - }, - - // driver s3 - { - EnvVars: []string{"STORAGE_USERS_DRIVER_S3_REGION"}, - Destination: &cfg.Reva.UserStorage.S3.Region, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_S3_ACCESS_KEY"}, - Destination: &cfg.Reva.UserStorage.S3.AccessKey, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_S3_SECRET_KEY"}, - Destination: &cfg.Reva.UserStorage.S3.SecretKey, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_S3_ENDPOINT"}, - Destination: &cfg.Reva.UserStorage.S3.Endpoint, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_S3_BUCKET"}, - Destination: &cfg.Reva.UserStorage.S3.Bucket, - }, - - // driver s3ng - { - EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_ROOT"}, - Destination: &cfg.Reva.UserStorage.S3NG.Root, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_LAYOUT"}, - Destination: &cfg.Reva.UserStorage.S3NG.UserLayout, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_SHARE_FOLDER"}, - Destination: &cfg.Reva.UserStorage.S3NG.ShareFolder, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_PERSONAL_SPACE_ALIAS_TEMPLATE"}, - Destination: &cfg.Reva.UserStorage.S3NG.PersonalSpaceAliasTemplate, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_GENERAL_SPACE_ALIAS_TEMPLATE"}, - Destination: &cfg.Reva.UserStorage.S3NG.GeneralSpaceAliasTemplate, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_REGION"}, - Destination: &cfg.Reva.UserStorage.S3NG.Region, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_ACCESS_KEY"}, - Destination: &cfg.Reva.UserStorage.S3NG.AccessKey, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_SECRET_KEY"}, - Destination: &cfg.Reva.UserStorage.S3NG.SecretKey, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_ENDPOINT"}, - Destination: &cfg.Reva.UserStorage.S3NG.Endpoint, - }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_BUCKET"}, - Destination: &cfg.Reva.UserStorage.S3NG.Bucket, - }, - - // metadata driver eos - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_NAMESPACE"}, - Destination: &cfg.Reva.MetadataStorage.EOS.Root, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SHADOW_NAMESPACE"}, - Destination: &cfg.Reva.MetadataStorage.EOS.ShadowNamespace, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_UPLOADS_NAMESPACE"}, - Destination: &cfg.Reva.MetadataStorage.EOS.UploadsNamespace, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SHARE_FOLDER"}, - Destination: &cfg.Reva.MetadataStorage.EOS.ShareFolder, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_BINARY"}, - Destination: &cfg.Reva.MetadataStorage.EOS.EosBinary, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_XRDCOPY_BINARY"}, - Destination: &cfg.Reva.MetadataStorage.EOS.XrdcopyBinary, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_MASTER_URL"}, - Destination: &cfg.Reva.MetadataStorage.EOS.MasterURL, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SLAVE_URL"}, - Destination: &cfg.Reva.MetadataStorage.EOS.SlaveURL, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_CACHE_DIRECTORY"}, - Destination: &cfg.Reva.MetadataStorage.EOS.CacheDirectory, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_ENABLE_LOGGING"}, - Destination: &cfg.Reva.MetadataStorage.EOS.EnableLogging, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SHOW_HIDDEN_SYSFILES"}, - Destination: &cfg.Reva.MetadataStorage.EOS.ShowHiddenSysFiles, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_FORCE_SINGLEUSER_MODE"}, - Destination: &cfg.Reva.MetadataStorage.EOS.ForceSingleUserMode, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_USE_KEYTAB"}, - Destination: &cfg.Reva.MetadataStorage.EOS.UseKeytab, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SEC_PROTOCOL"}, - Destination: &cfg.Reva.MetadataStorage.EOS.SecProtocol, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_KEYTAB"}, - Destination: &cfg.Reva.MetadataStorage.EOS.Keytab, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SINGLE_USERNAME"}, - Destination: &cfg.Reva.MetadataStorage.EOS.SingleUsername, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_LAYOUT"}, - Destination: &cfg.Reva.MetadataStorage.EOS.UserLayout, - }, - { - EnvVars: []string{"REVA_GATEWAY"}, - Destination: &cfg.Reva.MetadataStorage.EOS.GatewaySVC, - }, - - // metadata local driver - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_LOCAL_ROOT"}, - Destination: &cfg.Reva.MetadataStorage.Local.Root, - }, - - // metadata ocis driver - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_OCIS_LAYOUT"}, - Destination: &cfg.Reva.MetadataStorage.OCIS.UserLayout, - }, - - // metadata driver s3 - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_S3_REGION"}, - Destination: &cfg.Reva.MetadataStorage.S3.Region, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_S3_ACCESS_KEY"}, - Destination: &cfg.Reva.MetadataStorage.S3.AccessKey, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_S3_SECRET_KEY"}, - Destination: &cfg.Reva.MetadataStorage.S3.SecretKey, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_S3_ENDPOINT"}, - Destination: &cfg.Reva.MetadataStorage.S3.Endpoint, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_S3_BUCKET"}, - Destination: &cfg.Reva.MetadataStorage.S3.Bucket, - }, - - // driver s3ng - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_ROOT"}, - Destination: &cfg.Reva.MetadataStorage.S3NG.Root, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_LAYOUT"}, - Destination: &cfg.Reva.MetadataStorage.S3NG.UserLayout, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_REGION"}, - Destination: &cfg.Reva.MetadataStorage.S3NG.Region, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_ACCESS_KEY"}, - Destination: &cfg.Reva.MetadataStorage.S3NG.AccessKey, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_SECRET_KEY"}, - Destination: &cfg.Reva.MetadataStorage.S3NG.SecretKey, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_ENDPOINT"}, - Destination: &cfg.Reva.MetadataStorage.S3NG.Endpoint, - }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_BUCKET"}, - Destination: &cfg.Reva.MetadataStorage.S3NG.Bucket, - }, - - // permissions - { - EnvVars: []string{"STORAGE_PERMISSIONS_ENDPOINT"}, - Destination: &cfg.Reva.Permissions.Endpoint, - }, - - // ocdav - { - EnvVars: []string{"OCDAV_ADDR"}, - Destination: &cfg.OCDav.Addr, - }, - { - EnvVars: []string{"OCDAV_DEBUG_ADDR"}, - Destination: &cfg.OCDav.DebugAddr, - }, - { - EnvVars: []string{"OCDAV_PREFIX"}, - Destination: &cfg.OCDav.Prefix, - }, - { - EnvVars: []string{"OCDAV_WEBDAV_NAMESPACE"}, - Destination: &cfg.OCDav.WebdavNamespace, - }, - { - EnvVars: []string{"OCDAV_FILES_NAMESPACE"}, - Destination: &cfg.OCDav.FilesNamespace, - }, - { - EnvVars: []string{"OCDAV_SHARES_NAMESPACE"}, - Destination: &cfg.OCDav.SharesNamespace, - }, - { - EnvVars: []string{"OCIS_URL", "OCDAV_PUBLIC_URL"}, - Destination: &cfg.OCDav.PublicURL, - }, - { - EnvVars: []string{"OCIS_INSECURE", "OCDAV_INSECURE"}, - Destination: &cfg.OCDav.Insecure, - }, - { - EnvVars: []string{"OCIS_JWT_SECRET", "OCDAV_JWT_SECRET"}, - Destination: &cfg.OCDav.JWTSecret, - }, - } -} diff --git a/extensions/storage/pkg/config/defaults/defaultconfig.go b/extensions/storage/pkg/config/defaults/defaultconfig.go deleted file mode 100644 index 0e2faf43df..0000000000 --- a/extensions/storage/pkg/config/defaults/defaultconfig.go +++ /dev/null @@ -1,459 +0,0 @@ -package defaults - -import ( - "os" - "path" - - "github.com/owncloud/ocis/extensions/storage/pkg/config" - "github.com/owncloud/ocis/ocis-pkg/config/defaults" -) - -const ( - defaultPublicURL = "https://localhost:9200" - defaultShareFolder = "/Shares" - defaultStorageNamespace = "/users/{{.Id.OpaqueId}}" - defaultGatewayAddr = "127.0.0.1:9142" - defaultUserLayout = "{{.Id.OpaqueId}}" - defaultPersonalSpaceAliasTemplate = "{{.SpaceType}}/{{.User.Username | lower}}" - defaultGeneralSpaceAliasTemplate = "{{.SpaceType}}/{{.SpaceName | replace \" \" \"-\" | lower}}" -) - -func FullDefaultConfig() *config.Config { - cfg := DefaultConfig() - EnsureDefaults(cfg) - Sanitize(cfg) - return cfg -} - -func DefaultConfig() *config.Config { - return &config.Config{ - // log is inherited - Debug: config.Debug{ - Addr: "127.0.0.1:9109", - }, - Reva: config.Reva{ - SkipUserGroupsInToken: false, - TransferExpires: 24 * 60 * 60, - OIDC: config.OIDC{ - Issuer: defaultPublicURL, - Insecure: false, - IDClaim: "preferred_username", - }, - LDAP: config.LDAP{ - URI: "ldaps://localhost:9235", - CACert: path.Join(defaults.BaseDataPath(), "idm", "ldap.crt"), - Insecure: false, - UserBaseDN: "ou=users,o=libregraph-idm", - GroupBaseDN: "ou=groups,o=libregraph-idm", - UserScope: "sub", - GroupScope: "sub", - LoginAttributes: []string{"uid", "mail"}, - UserFilter: "", - GroupFilter: "", - UserObjectClass: "inetOrgPerson", - GroupObjectClass: "groupOfNames", - BindDN: "uid=reva,ou=sysusers,o=libregraph-idm", - IDP: defaultPublicURL, - UserSchema: config.LDAPUserSchema{ - ID: "ownclouduuid", - Mail: "mail", - DisplayName: "displayname", - Username: "uid", - UIDNumber: "uidnumber", - GIDNumber: "gidnumber", - }, - GroupSchema: config.LDAPGroupSchema{ - ID: "ownclouduuid", - Mail: "mail", - DisplayName: "cn", - Groupname: "cn", - Member: "member", - GIDNumber: "gidnumber", - }, - }, - UserGroupRest: config.UserGroupRest{ - RedisAddress: "localhost:6379", - }, - UserOwnCloudSQL: config.UserOwnCloudSQL{ - DBUsername: "owncloud", - DBHost: "mysql", - DBPort: 3306, - DBName: "owncloud", - Idp: defaultPublicURL, - Nobody: 90, - JoinUsername: false, - JoinOwnCloudUUID: false, - EnableMedialSearch: false, - }, - Archiver: config.Archiver{ - MaxNumFiles: 10000, - MaxSize: 1073741824, - ArchiverURL: "/archiver", - }, - UserStorage: config.StorageConfig{ - EOS: config.DriverEOS{ - DriverCommon: config.DriverCommon{ - Root: "/eos/dockertest/reva", - ShareFolder: defaultShareFolder, - 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: defaultGatewayAddr, - }, - Local: config.DriverCommon{ - Root: path.Join(defaults.BaseDataPath(), "storage", "local", "users"), - ShareFolder: defaultShareFolder, - UserLayout: "{{.Username}}", - EnableHome: false, - }, - OwnCloudSQL: config.DriverOwnCloudSQL{ - DriverCommon: config.DriverCommon{ - Root: path.Join(defaults.BaseDataPath(), "storage", "owncloud"), - ShareFolder: defaultShareFolder, - UserLayout: "{{.Username}}", - EnableHome: false, - }, - UploadInfoDir: path.Join(defaults.BaseDataPath(), "storage", "uploadinfo"), - DBUsername: "owncloud", - DBPassword: "owncloud", - DBHost: "", - DBPort: 3306, - DBName: "owncloud", - }, - S3: config.DriverS3{ - DriverCommon: config.DriverCommon{}, - Region: "default", - AccessKey: "", - SecretKey: "", - Endpoint: "", - Bucket: "", - }, - S3NG: config.DriverS3NG{ - DriverCommon: config.DriverCommon{ - Root: path.Join(defaults.BaseDataPath(), "storage", "users"), - ShareFolder: defaultShareFolder, - UserLayout: defaultUserLayout, - PersonalSpaceAliasTemplate: defaultPersonalSpaceAliasTemplate, - GeneralSpaceAliasTemplate: defaultGeneralSpaceAliasTemplate, - EnableHome: false, - }, - Region: "default", - AccessKey: "", - SecretKey: "", - Endpoint: "", - Bucket: "", - }, - OCIS: config.DriverOCIS{ - DriverCommon: config.DriverCommon{ - Root: path.Join(defaults.BaseDataPath(), "storage", "users"), - ShareFolder: defaultShareFolder, - UserLayout: defaultUserLayout, - PersonalSpaceAliasTemplate: defaultPersonalSpaceAliasTemplate, - GeneralSpaceAliasTemplate: defaultGeneralSpaceAliasTemplate, - }, - }, - }, - MetadataStorage: config.StorageConfig{ - EOS: config.DriverEOS{ - DriverCommon: config.DriverCommon{ - Root: "/eos/dockertest/reva", - ShareFolder: defaultShareFolder, - 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: defaultGatewayAddr, - }, - Local: config.DriverCommon{ - Root: path.Join(defaults.BaseDataPath(), "storage", "local", "metadata"), - }, - OwnCloudSQL: config.DriverOwnCloudSQL{}, - S3: config.DriverS3{ - DriverCommon: config.DriverCommon{}, - Region: "default", - }, - S3NG: config.DriverS3NG{ - DriverCommon: config.DriverCommon{ - Root: path.Join(defaults.BaseDataPath(), "storage", "metadata"), - ShareFolder: "", - UserLayout: defaultUserLayout, - EnableHome: false, - }, - Region: "default", - AccessKey: "", - SecretKey: "", - Endpoint: "", - Bucket: "", - }, - OCIS: config.DriverOCIS{ - DriverCommon: config.DriverCommon{ - Root: path.Join(defaults.BaseDataPath(), "storage", "metadata"), - ShareFolder: "", - UserLayout: defaultUserLayout, - EnableHome: false, - }, - }, - }, - Frontend: config.FrontendPort{ - Port: config.Port{ - MaxCPUs: "", - LogLevel: "", - GRPCNetwork: "", - GRPCAddr: "", - HTTPNetwork: "tcp", - HTTPAddr: "127.0.0.1:9140", - Protocol: "", - Endpoint: "", - DebugAddr: "127.0.0.1:9141", - Services: []string{"datagateway", "ocs", "appprovider"}, - Config: nil, - Context: nil, - Supervised: false, - }, - AppProviderInsecure: false, - AppProviderPrefix: "", - ArchiverInsecure: false, - ArchiverPrefix: "archiver", - DatagatewayPrefix: "data", - Favorites: false, - ProjectSpaces: true, - OCSPrefix: "ocs", - OCSSharePrefix: defaultShareFolder, - OCSHomeNamespace: defaultStorageNamespace, - PublicURL: defaultPublicURL, - OCSCacheWarmupDriver: "", - OCSAdditionalInfoAttribute: "{{.Mail}}", - OCSResourceInfoCacheTTL: 0, - Middleware: config.Middleware{}, - }, - DataGateway: config.DataGatewayPort{ - Port: config.Port{}, - PublicURL: "", - }, - Gateway: config.Gateway{ - Port: config.Port{ - Endpoint: defaultGatewayAddr, - DebugAddr: "127.0.0.1:9143", - GRPCNetwork: "tcp", - GRPCAddr: defaultGatewayAddr, - }, - CommitShareToStorageGrant: true, - CommitShareToStorageRef: true, - DisableHomeCreationOnLogin: true, - ShareFolder: "Shares", - LinkGrants: "", - HomeMapping: "", - EtagCacheTTL: 0, - }, - StorageRegistry: config.StorageRegistry{ - Driver: "spaces", - HomeProvider: "/home", // unused for spaces, static currently not supported - JSON: "", - }, - AppRegistry: config.AppRegistry{ - Driver: "static", - MimetypesJSON: "", - }, - Users: config.Users{ - Port: config.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: config.Groups{ - Port: config.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: config.Users{ - Port: config.Port{}, - Driver: "ldap", - UserGroupsCacheExpiration: 0, - }, - AuthBasic: config.Port{ - GRPCNetwork: "tcp", - GRPCAddr: "127.0.0.1:9146", - DebugAddr: "127.0.0.1:9147", - Services: []string{"authprovider"}, - Endpoint: "localhost:9146", - }, - AuthBearer: config.Port{ - GRPCNetwork: "tcp", - GRPCAddr: "127.0.0.1:9148", - DebugAddr: "127.0.0.1:9149", - Services: []string{"authprovider"}, - Endpoint: "localhost:9148", - }, - AuthMachine: config.Port{ - GRPCNetwork: "tcp", - GRPCAddr: "127.0.0.1:9166", - DebugAddr: "127.0.0.1:9167", - Services: []string{"authprovider"}, - Endpoint: "localhost:9166", - }, - AuthMachineConfig: config.AuthMachineConfig{}, - Sharing: config.Sharing{ - Port: config.Port{ - Endpoint: "localhost:9150", - DebugAddr: "127.0.0.1:9151", - GRPCNetwork: "tcp", - GRPCAddr: "127.0.0.1:9150", - Services: []string{"usershareprovider", "publicshareprovider"}, - }, - CS3ProviderAddr: "127.0.0.1:9215", // metadata storage - CS3ServiceUser: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad", - CS3ServiceUserIdp: "internal", - 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: "", - Events: config.Events{ - Address: "127.0.0.1:9233", - ClusterID: "ocis-cluster", - }, - }, - StorageShares: config.StoragePort{ - Port: config.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", - }, - ReadOnly: false, - AlternativeID: "1284d238-aa92-42ce-bdc4-0b0000009154", - MountID: "1284d238-aa92-42ce-bdc4-0b0000009157", - }, - StorageUsers: config.StoragePort{ - Port: config.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", - }, - MountID: "1284d238-aa92-42ce-bdc4-0b0000009157", - Driver: "ocis", - DataServerURL: "http://localhost:9158/data", - HTTPPrefix: "data", - TempFolder: path.Join(defaults.BaseDataPath(), "tmp", "users"), - }, - StoragePublicLink: config.PublicStorage{ - StoragePort: config.StoragePort{ - Port: config.Port{ - Endpoint: "localhost:9178", - DebugAddr: "127.0.0.1:9179", - GRPCNetwork: "tcp", - GRPCAddr: "127.0.0.1:9178", - }, - MountID: "7993447f-687f-490d-875c-ac95e89a62a4", - }, - PublicShareProviderAddr: "", - UserProviderAddr: "", - }, - StorageMetadata: config.StoragePort{ - Port: config.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: config.DataProvider{}, - }, - AppProvider: config.AppProvider{ - Port: config.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: config.WopiDriver{}, - AppsURL: "/app/list", - OpenURL: "/app/open", - NewURL: "/app/new", - }, - Permissions: config.Port{ - Endpoint: "localhost:9191", - }, - Configs: nil, - UploadMaxChunkSize: 1e+8, - UploadHTTPMethodOverride: "", - ChecksumSupportedTypes: []string{"sha1", "md5", "adler32"}, - ChecksumPreferredUploadType: "", - DefaultUploadProtocol: "tus", - }, - // TODO move ocdav config to a separate service - OCDav: config.OCDav{ - Addr: "127.0.0.1:0", // :0 to pick any local free port - DebugAddr: "127.0.0.1:9163", - WebdavNamespace: defaultStorageNamespace, - FilesNamespace: defaultStorageNamespace, - SharesNamespace: defaultShareFolder, - PublicURL: defaultPublicURL, - Prefix: "", - GatewaySVC: defaultGatewayAddr, - Insecure: false, // true? - Timeout: 84300, - }, - Tracing: config.Tracing{ - Service: "storage", - Type: "jaeger", - }, - Asset: config.Asset{}, - } -} - -func EnsureDefaults(cfg *config.Config) { -} - -func Sanitize(cfg *config.Config) { -} diff --git a/extensions/storage/pkg/config/parser/parse.go b/extensions/storage/pkg/config/parser/parse.go deleted file mode 100644 index d486f6dad4..0000000000 --- a/extensions/storage/pkg/config/parser/parse.go +++ /dev/null @@ -1,37 +0,0 @@ -package parser - -import ( - "errors" - - "github.com/owncloud/ocis/extensions/storage-metadata/pkg/config" - "github.com/owncloud/ocis/extensions/storage-metadata/pkg/config/defaults" - ociscfg "github.com/owncloud/ocis/ocis-pkg/config" - - "github.com/owncloud/ocis/ocis-pkg/config/envdecode" -) - -// ParseConfig loads configuration from known paths. -func ParseConfig(cfg *config.Config) error { - _, err := ociscfg.BindSourcesToStructs(cfg.Service.Name, cfg) - if err != nil { - return err - } - - defaults.EnsureDefaults(cfg) - - // load all env variables relevant to the config in the current context. - if err := envdecode.Decode(cfg); err != nil { - // no environment variable set for this config is an expected "error" - if !errors.Is(err, envdecode.ErrNoTargetFieldsAreSet) { - return err - } - } - - defaults.Sanitize(cfg) - - return Validate(cfg) -} - -func Validate(cfg *config.Config) error { - return nil -} diff --git a/extensions/storage/pkg/tracing/tracing.go b/extensions/storage/pkg/tracing/tracing.go deleted file mode 100644 index acb788e21c..0000000000 --- a/extensions/storage/pkg/tracing/tracing.go +++ /dev/null @@ -1,38 +0,0 @@ -package tracing - -import ( - "github.com/owncloud/ocis/extensions/storage/pkg/config" - "github.com/owncloud/ocis/ocis-pkg/log" -) - -// Configure for Reva serves only as informational / instructive log messages. Tracing config will be delegated directly -// to Reva services. -func Configure(cfg *config.Config, logger log.Logger) { - if cfg.Tracing.Enabled { - switch cfg.Tracing.Type { - case "agent": - logger.Error(). - Str("type", cfg.Tracing.Type). - Msg("Reva only supports the jaeger tracing backend") - - case "jaeger": - logger.Info(). - Str("type", cfg.Tracing.Type). - Msg("configuring storage to use the jaeger tracing backend") - - case "zipkin": - logger.Error(). - Str("type", cfg.Tracing.Type). - Msg("Reva only supports the jaeger tracing backend") - - default: - logger.Warn(). - Str("type", cfg.Tracing.Type). - Msg("Unknown tracing backend") - } - - } else { - logger.Debug(). - Msg("Tracing is not enabled") - } -} diff --git a/extensions/storage/reflex.conf b/extensions/storage/reflex.conf deleted file mode 100644 index 1035f881c5..0000000000 --- a/extensions/storage/reflex.conf +++ /dev/null @@ -1,5 +0,0 @@ -# backend --r '^(cmd|pkg)/.*\.go$' -R '^node_modules/' -s -- sh -c 'make bin/ocis-reva-debug && bin/ocis-reva-debug --log-level debug server --debug-pprof --debug-zpages --asset-path assets/' - -# frontend --r '^ui/.*\.(vue|js)$' -R '^node_modules/' -- sh -c 'yarn build' diff --git a/extensions/user/pkg/command/command.go b/extensions/user/pkg/command/command.go index 27e7cabfab..7214e12e21 100644 --- a/extensions/user/pkg/command/command.go +++ b/extensions/user/pkg/command/command.go @@ -11,9 +11,9 @@ import ( "github.com/cs3org/reva/v2/cmd/revad/runtime" "github.com/gofrs/uuid" "github.com/oklog/run" - "github.com/owncloud/ocis/extensions/storage/pkg/server/debug" "github.com/owncloud/ocis/extensions/user/pkg/config" "github.com/owncloud/ocis/extensions/user/pkg/config/parser" + "github.com/owncloud/ocis/extensions/user/pkg/server/debug" ociscfg "github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/ldap" "github.com/owncloud/ocis/ocis-pkg/log" @@ -88,13 +88,9 @@ func User(cfg *config.Config) *cli.Command { }) debugServer, err := debug.Server( - debug.Name(c.Command.Name+"-debug"), - debug.Addr(cfg.Debug.Addr), debug.Logger(logger), debug.Context(ctx), - debug.Pprof(cfg.Debug.Pprof), - debug.Zpages(cfg.Debug.Zpages), - debug.Token(cfg.Debug.Token), + debug.Config(cfg), ) if err != nil { diff --git a/extensions/user/pkg/server/debug/option.go b/extensions/user/pkg/server/debug/option.go new file mode 100644 index 0000000000..31bbf15052 --- /dev/null +++ b/extensions/user/pkg/server/debug/option.go @@ -0,0 +1,50 @@ +package debug + +import ( + "context" + + "github.com/owncloud/ocis/extensions/user/pkg/config" + "github.com/owncloud/ocis/ocis-pkg/log" +) + +// Option defines a single option function. +type Option func(o *Options) + +// Options defines the available options for this package. +type Options struct { + Logger log.Logger + Context context.Context + Config *config.Config +} + +// newOptions initializes the available default options. +func newOptions(opts ...Option) Options { + opt := Options{} + + for _, o := range opts { + o(&opt) + } + + return opt +} + +// Logger provides a function to set the logger option. +func Logger(val log.Logger) Option { + return func(o *Options) { + o.Logger = val + } +} + +// Context provides a function to set the context option. +func Context(val context.Context) Option { + return func(o *Options) { + o.Context = val + } +} + +// Config provides a function to set the config option. +func Config(val *config.Config) Option { + return func(o *Options) { + o.Config = val + } +} diff --git a/extensions/storage/pkg/server/debug/server.go b/extensions/user/pkg/server/debug/server.go similarity index 71% rename from extensions/storage/pkg/server/debug/server.go rename to extensions/user/pkg/server/debug/server.go index 0038e858e8..27adbcdc64 100644 --- a/extensions/storage/pkg/server/debug/server.go +++ b/extensions/user/pkg/server/debug/server.go @@ -4,7 +4,7 @@ import ( "io" "net/http" - "github.com/owncloud/ocis/extensions/storage/pkg/config" + "github.com/owncloud/ocis/extensions/user/pkg/config" "github.com/owncloud/ocis/ocis-pkg/service/debug" "github.com/owncloud/ocis/ocis-pkg/version" ) @@ -15,14 +15,18 @@ func Server(opts ...Option) (*http.Server, error) { return debug.NewService( debug.Logger(options.Logger), - debug.Name(options.Name), + debug.Name(options.Config.Service.Name), debug.Version(version.String), - debug.Address(options.Addr), - debug.Token(options.Token), - debug.Pprof(options.Pprof), - debug.Zpages(options.Zpages), + debug.Address(options.Config.Debug.Addr), + debug.Token(options.Config.Debug.Token), + debug.Pprof(options.Config.Debug.Pprof), + debug.Zpages(options.Config.Debug.Zpages), debug.Health(health(options.Config)), debug.Ready(ready(options.Config)), + //debug.CorsAllowedOrigins(options.Config.HTTP.CORS.AllowedOrigins), + //debug.CorsAllowedMethods(options.Config.HTTP.CORS.AllowedMethods), + //debug.CorsAllowedHeaders(options.Config.HTTP.CORS.AllowedHeaders), + //debug.CorsAllowCredentials(options.Config.HTTP.CORS.AllowCredentials), ), nil } diff --git a/extensions/storage/pkg/service/external/external.go b/ocis-pkg/service/external/external.go similarity index 100% rename from extensions/storage/pkg/service/external/external.go rename to ocis-pkg/service/external/external.go diff --git a/extensions/storage/pkg/service/external/external_test.go b/ocis-pkg/service/external/external_test.go similarity index 100% rename from extensions/storage/pkg/service/external/external_test.go rename to ocis-pkg/service/external/external_test.go