From 18e9661a247a9589dfcc4508d42dfdf060803d74 Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Mon, 2 May 2022 12:02:09 +0200 Subject: [PATCH] fix ocis config parsing for subcommands --- ocis/pkg/command/accounts.go | 9 +++++---- ocis/pkg/command/audit.go | 9 +++++---- ocis/pkg/command/glauth.go | 9 +++++---- ocis/pkg/command/graph.go | 9 +++++---- ocis/pkg/command/graphexplorer.go | 9 +++++---- ocis/pkg/command/idm.go | 9 +++++---- ocis/pkg/command/idp.go | 9 +++++---- ocis/pkg/command/natsserver.go | 9 +++++---- ocis/pkg/command/notifications.go | 9 +++++---- ocis/pkg/command/ocdav.go | 14 +++++++++++--- ocis/pkg/command/ocs.go | 9 +++++---- ocis/pkg/command/proxy.go | 9 +++++---- ocis/pkg/command/settings.go | 9 +++++---- ocis/pkg/command/storageappprovider.go | 11 +++++++++++ ocis/pkg/command/storageauthbasic.go | 11 +++++++++++ ocis/pkg/command/storageauthbearer.go | 11 +++++++++++ ocis/pkg/command/storageauthmachine.go | 11 +++++++++++ ocis/pkg/command/storagefrontend.go | 11 +++++++++++ ocis/pkg/command/storagegateway.go | 15 +++++++++++---- ocis/pkg/command/storagegroupprovider.go | 11 +++++++++++ ocis/pkg/command/storagemetadata.go | 11 +++++++++++ ocis/pkg/command/storagepubliclink.go | 11 +++++++++++ ocis/pkg/command/storageshares.go | 11 +++++++++++ ocis/pkg/command/storagesharing.go | 11 +++++++++++ ocis/pkg/command/storageuserprovider.go | 11 +++++++++++ ocis/pkg/command/store.go | 9 +++++---- ocis/pkg/command/thumbnails.go | 9 +++++---- ocis/pkg/command/web.go | 9 +++++---- ocis/pkg/command/webdav.go | 9 +++++---- 29 files changed, 223 insertions(+), 71 deletions(-) diff --git a/ocis/pkg/command/accounts.go b/ocis/pkg/command/accounts.go index 8434e0c2f5..e9981b9f54 100644 --- a/ocis/pkg/command/accounts.go +++ b/ocis/pkg/command/accounts.go @@ -16,12 +16,13 @@ func AccountsCommand(cfg *config.Config) *cli.Command { Name: cfg.Accounts.Service.Name, Usage: subcommandDescription(cfg.Accounts.Service.Name), Category: "extensions", - Before: func(ctx *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { fmt.Printf("%v", err) + return err } - return err + cfg.Accounts.Commons = cfg.Commons + return nil }, Subcommands: command.GetCommands(cfg.Accounts), } diff --git a/ocis/pkg/command/audit.go b/ocis/pkg/command/audit.go index 884b79fb3e..03d390e632 100644 --- a/ocis/pkg/command/audit.go +++ b/ocis/pkg/command/audit.go @@ -16,12 +16,13 @@ func AuditCommand(cfg *config.Config) *cli.Command { Name: "audit", Usage: "start audit service", Category: "extensions", - Before: func(ctx *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { fmt.Printf("%v", err) + return err } - return err + cfg.Audit.Commons = cfg.Commons + return nil }, Subcommands: command.GetCommands(cfg.Audit), } diff --git a/ocis/pkg/command/glauth.go b/ocis/pkg/command/glauth.go index bbe5af9e7f..8a3059efff 100644 --- a/ocis/pkg/command/glauth.go +++ b/ocis/pkg/command/glauth.go @@ -16,12 +16,13 @@ func GLAuthCommand(cfg *config.Config) *cli.Command { Name: cfg.GLAuth.Service.Name, Usage: subcommandDescription(cfg.GLAuth.Service.Name), Category: "extensions", - Before: func(ctx *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { fmt.Printf("%v", err) + return err } - return err + cfg.GLAuth.Commons = cfg.Commons + return nil }, Subcommands: command.GetCommands(cfg.GLAuth), } diff --git a/ocis/pkg/command/graph.go b/ocis/pkg/command/graph.go index 34158e1cc3..89dc41f64c 100644 --- a/ocis/pkg/command/graph.go +++ b/ocis/pkg/command/graph.go @@ -16,12 +16,13 @@ func GraphCommand(cfg *config.Config) *cli.Command { Name: cfg.Graph.Service.Name, Usage: subcommandDescription(cfg.Graph.Service.Name), Category: "extensions", - Before: func(ctx *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { fmt.Printf("%v", err) + return err } - return err + cfg.Graph.Commons = cfg.Commons + return nil }, Subcommands: command.GetCommands(cfg.Graph), } diff --git a/ocis/pkg/command/graphexplorer.go b/ocis/pkg/command/graphexplorer.go index 6e1f890fbd..ad33cf7b4a 100644 --- a/ocis/pkg/command/graphexplorer.go +++ b/ocis/pkg/command/graphexplorer.go @@ -16,12 +16,13 @@ func GraphExplorerCommand(cfg *config.Config) *cli.Command { Name: cfg.GraphExplorer.Service.Name, Usage: subcommandDescription(cfg.GraphExplorer.Service.Name), Category: "extensions", - Before: func(ctx *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { fmt.Printf("%v", err) + return err } - return err + cfg.GraphExplorer.Commons = cfg.Commons + return nil }, Subcommands: command.GetCommands(cfg.GraphExplorer), } diff --git a/ocis/pkg/command/idm.go b/ocis/pkg/command/idm.go index 86d3cae777..9a375c8c68 100644 --- a/ocis/pkg/command/idm.go +++ b/ocis/pkg/command/idm.go @@ -16,12 +16,13 @@ func IDMCommand(cfg *config.Config) *cli.Command { Name: "idm", Usage: "idm extension commands", Category: "extensions", - Before: func(ctx *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { fmt.Printf("%v", err) + return err } - return err + cfg.IDM.Commons = cfg.Commons + return nil }, Subcommands: command.GetCommands(cfg.IDM), } diff --git a/ocis/pkg/command/idp.go b/ocis/pkg/command/idp.go index 0f37a98c05..82909ee9a8 100644 --- a/ocis/pkg/command/idp.go +++ b/ocis/pkg/command/idp.go @@ -16,12 +16,13 @@ func IDPCommand(cfg *config.Config) *cli.Command { Name: cfg.IDP.Service.Name, Usage: subcommandDescription(cfg.IDP.Service.Name), Category: "extensions", - Before: func(ctx *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { fmt.Printf("%v", err) + return err } - return err + cfg.IDP.Commons = cfg.Commons + return nil }, Subcommands: command.GetCommands(cfg.IDP), } diff --git a/ocis/pkg/command/natsserver.go b/ocis/pkg/command/natsserver.go index 6a46a1cc7a..48cf8174a8 100644 --- a/ocis/pkg/command/natsserver.go +++ b/ocis/pkg/command/natsserver.go @@ -16,12 +16,13 @@ func NatsServerCommand(cfg *config.Config) *cli.Command { Name: "nats-server", Usage: "start nats server", Category: "extensions", - Before: func(ctx *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { fmt.Printf("%v", err) + return err } - return err + cfg.Nats.Commons = cfg.Commons + return nil }, Subcommands: command.GetCommands(cfg.Nats), } diff --git a/ocis/pkg/command/notifications.go b/ocis/pkg/command/notifications.go index a6f1113d74..ee362dc7ed 100644 --- a/ocis/pkg/command/notifications.go +++ b/ocis/pkg/command/notifications.go @@ -16,12 +16,13 @@ func NotificationsCommand(cfg *config.Config) *cli.Command { Name: "notifications", Usage: "start notifications service", Category: "extensions", - Before: func(ctx *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { fmt.Printf("%v", err) + return err } - return err + cfg.Notifications.Commons = cfg.Commons + return nil }, Subcommands: command.GetCommands(cfg.Notifications), } diff --git a/ocis/pkg/command/ocdav.go b/ocis/pkg/command/ocdav.go index c13e6ee07f..85fdeb4570 100644 --- a/ocis/pkg/command/ocdav.go +++ b/ocis/pkg/command/ocdav.go @@ -1,8 +1,11 @@ package command import ( + "fmt" + "github.com/owncloud/ocis/extensions/ocdav/pkg/command" "github.com/owncloud/ocis/ocis-pkg/config" + "github.com/owncloud/ocis/ocis-pkg/config/parser" "github.com/owncloud/ocis/ocis/pkg/register" "github.com/urfave/cli/v2" ) @@ -13,9 +16,14 @@ func OCDavCommand(cfg *config.Config) *cli.Command { Name: "ocdav", Usage: "start ocdav", Category: "extensions", - // Before: func(ctx *cli.Context) error { - // return ParseStorageCommon(ctx, cfg) - // }, + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { + fmt.Printf("%v", err) + return err + } + cfg.OCDav.Commons = cfg.Commons + return nil + }, Action: func(c *cli.Context) error { origCmd := command.OCDav(cfg.OCDav) return handleOriginalAction(c, origCmd) diff --git a/ocis/pkg/command/ocs.go b/ocis/pkg/command/ocs.go index fdd76af613..b2f1b5bd62 100644 --- a/ocis/pkg/command/ocs.go +++ b/ocis/pkg/command/ocs.go @@ -16,12 +16,13 @@ func OCSCommand(cfg *config.Config) *cli.Command { Name: cfg.OCS.Service.Name, Usage: subcommandDescription(cfg.OCS.Service.Name), Category: "extensions", - Before: func(ctx *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { fmt.Printf("%v", err) + return err } - return err + cfg.OCS.Commons = cfg.Commons + return nil }, Subcommands: command.GetCommands(cfg.OCS), } diff --git a/ocis/pkg/command/proxy.go b/ocis/pkg/command/proxy.go index a23eec33cf..219a4c06e1 100644 --- a/ocis/pkg/command/proxy.go +++ b/ocis/pkg/command/proxy.go @@ -16,12 +16,13 @@ func ProxyCommand(cfg *config.Config) *cli.Command { Name: cfg.Proxy.Service.Name, Usage: subcommandDescription(cfg.Proxy.Service.Name), Category: "extensions", - Before: func(ctx *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { fmt.Printf("%v", err) + return err } - return err + cfg.Proxy.Commons = cfg.Commons + return nil }, Subcommands: command.GetCommands(cfg.Proxy), } diff --git a/ocis/pkg/command/settings.go b/ocis/pkg/command/settings.go index 33032f30c0..1a454bf58c 100644 --- a/ocis/pkg/command/settings.go +++ b/ocis/pkg/command/settings.go @@ -16,12 +16,13 @@ func SettingsCommand(cfg *config.Config) *cli.Command { Name: cfg.Settings.Service.Name, Usage: subcommandDescription(cfg.Settings.Service.Name), Category: "extensions", - Before: func(ctx *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { fmt.Printf("%v", err) + return err } - return err + cfg.Settings.Commons = cfg.Commons + return nil }, Subcommands: command.GetCommands(cfg.Settings), } diff --git a/ocis/pkg/command/storageappprovider.go b/ocis/pkg/command/storageappprovider.go index beb494d341..f44aa55fad 100644 --- a/ocis/pkg/command/storageappprovider.go +++ b/ocis/pkg/command/storageappprovider.go @@ -1,8 +1,11 @@ package command import ( + "fmt" + "github.com/owncloud/ocis/extensions/appprovider/pkg/command" "github.com/owncloud/ocis/ocis-pkg/config" + "github.com/owncloud/ocis/ocis-pkg/config/parser" "github.com/owncloud/ocis/ocis/pkg/register" "github.com/urfave/cli/v2" ) @@ -13,6 +16,14 @@ func StorageAppProviderCommand(cfg *config.Config) *cli.Command { Name: "storage-app-provider", Usage: "start storage app-provider service", Category: "extensions", + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { + fmt.Printf("%v", err) + return err + } + cfg.AppProvider.Commons = cfg.Commons + return nil + }, Action: func(c *cli.Context) error { origCmd := command.AppProvider(cfg.AppProvider) return handleOriginalAction(c, origCmd) diff --git a/ocis/pkg/command/storageauthbasic.go b/ocis/pkg/command/storageauthbasic.go index 26164983f7..4c8dba5cdb 100644 --- a/ocis/pkg/command/storageauthbasic.go +++ b/ocis/pkg/command/storageauthbasic.go @@ -1,8 +1,11 @@ package command import ( + "fmt" + "github.com/owncloud/ocis/extensions/auth-basic/pkg/command" "github.com/owncloud/ocis/ocis-pkg/config" + "github.com/owncloud/ocis/ocis-pkg/config/parser" "github.com/owncloud/ocis/ocis/pkg/register" "github.com/urfave/cli/v2" ) @@ -13,6 +16,14 @@ func StorageAuthBasicCommand(cfg *config.Config) *cli.Command { Name: "storage-auth-basic", Usage: "start storage auth-basic service", Category: "extensions", + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { + fmt.Printf("%v", err) + return err + } + cfg.AuthBasic.Commons = cfg.Commons + return nil + }, Action: func(c *cli.Context) error { origCmd := command.AuthBasic(cfg.AuthBasic) return handleOriginalAction(c, origCmd) diff --git a/ocis/pkg/command/storageauthbearer.go b/ocis/pkg/command/storageauthbearer.go index c3c9855d84..20b641cda4 100644 --- a/ocis/pkg/command/storageauthbearer.go +++ b/ocis/pkg/command/storageauthbearer.go @@ -1,8 +1,11 @@ package command import ( + "fmt" + "github.com/owncloud/ocis/extensions/auth-bearer/pkg/command" "github.com/owncloud/ocis/ocis-pkg/config" + "github.com/owncloud/ocis/ocis-pkg/config/parser" "github.com/owncloud/ocis/ocis/pkg/register" "github.com/urfave/cli/v2" ) @@ -13,6 +16,14 @@ func StorageAuthBearerCommand(cfg *config.Config) *cli.Command { Name: "storage-auth-bearer", Usage: "Start storage auth-bearer service", Category: "extensions", + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { + fmt.Printf("%v", err) + return err + } + cfg.AuthBearer.Commons = cfg.Commons + return nil + }, Action: func(c *cli.Context) error { origCmd := command.AuthBearer(cfg.AuthBearer) return handleOriginalAction(c, origCmd) diff --git a/ocis/pkg/command/storageauthmachine.go b/ocis/pkg/command/storageauthmachine.go index bbed4b2c1e..f42ecb4b55 100644 --- a/ocis/pkg/command/storageauthmachine.go +++ b/ocis/pkg/command/storageauthmachine.go @@ -1,8 +1,11 @@ package command import ( + "fmt" + "github.com/owncloud/ocis/extensions/auth-machine/pkg/command" "github.com/owncloud/ocis/ocis-pkg/config" + "github.com/owncloud/ocis/ocis-pkg/config/parser" "github.com/owncloud/ocis/ocis/pkg/register" "github.com/urfave/cli/v2" ) @@ -13,6 +16,14 @@ func StorageAuthMachineCommand(cfg *config.Config) *cli.Command { Name: "storage-auth-machine", Usage: "start storage auth-machine service", Category: "extensions", + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { + fmt.Printf("%v", err) + return err + } + cfg.AuthMachine.Commons = cfg.Commons + return nil + }, Action: func(c *cli.Context) error { origCmd := command.AuthMachine(cfg.AuthMachine) return handleOriginalAction(c, origCmd) diff --git a/ocis/pkg/command/storagefrontend.go b/ocis/pkg/command/storagefrontend.go index 4d37589fee..05252414a9 100644 --- a/ocis/pkg/command/storagefrontend.go +++ b/ocis/pkg/command/storagefrontend.go @@ -1,8 +1,11 @@ package command import ( + "fmt" + "github.com/owncloud/ocis/extensions/frontend/pkg/command" "github.com/owncloud/ocis/ocis-pkg/config" + "github.com/owncloud/ocis/ocis-pkg/config/parser" "github.com/owncloud/ocis/ocis/pkg/register" "github.com/urfave/cli/v2" ) @@ -13,6 +16,14 @@ func StorageFrontendCommand(cfg *config.Config) *cli.Command { Name: "storage-frontend", Usage: "start storage frontend", Category: "extensions", + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { + fmt.Printf("%v", err) + return err + } + cfg.Frontend.Commons = cfg.Commons + return nil + }, Action: func(c *cli.Context) error { origCmd := command.Frontend(cfg.Frontend) return handleOriginalAction(c, origCmd) diff --git a/ocis/pkg/command/storagegateway.go b/ocis/pkg/command/storagegateway.go index f69adc3053..17047b6068 100644 --- a/ocis/pkg/command/storagegateway.go +++ b/ocis/pkg/command/storagegateway.go @@ -1,8 +1,11 @@ package command import ( + "fmt" + "github.com/owncloud/ocis/extensions/gateway/pkg/command" "github.com/owncloud/ocis/ocis-pkg/config" + "github.com/owncloud/ocis/ocis-pkg/config/parser" "github.com/owncloud/ocis/ocis/pkg/register" "github.com/urfave/cli/v2" ) @@ -13,10 +16,14 @@ func StorageGatewayCommand(cfg *config.Config) *cli.Command { Name: "storage-gateway", Usage: "start storage gateway", Category: "extensions", - //Flags: flagset.GatewayWithConfig(cfg.Storage), - // Before: func(ctx *cli.Context) error { - // return ParseStorageCommon(ctx, cfg) - // }, + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { + fmt.Printf("%v", err) + return err + } + cfg.Gateway.Commons = cfg.Commons + return nil + }, Action: func(c *cli.Context) error { origCmd := command.Gateway(cfg.Gateway) return handleOriginalAction(c, origCmd) diff --git a/ocis/pkg/command/storagegroupprovider.go b/ocis/pkg/command/storagegroupprovider.go index 2e39709ee1..c93de96c11 100644 --- a/ocis/pkg/command/storagegroupprovider.go +++ b/ocis/pkg/command/storagegroupprovider.go @@ -1,8 +1,11 @@ package command import ( + "fmt" + "github.com/owncloud/ocis/extensions/group/pkg/command" "github.com/owncloud/ocis/ocis-pkg/config" + "github.com/owncloud/ocis/ocis-pkg/config/parser" "github.com/owncloud/ocis/ocis/pkg/register" "github.com/urfave/cli/v2" ) @@ -13,6 +16,14 @@ func StorageGroupProviderCommand(cfg *config.Config) *cli.Command { Name: "storage-groupprovider", Usage: "start storage groupprovider service", Category: "extensions", + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { + fmt.Printf("%v", err) + return err + } + cfg.Group.Commons = cfg.Commons + return nil + }, Action: func(c *cli.Context) error { origCmd := command.Groups(cfg.Group) return handleOriginalAction(c, origCmd) diff --git a/ocis/pkg/command/storagemetadata.go b/ocis/pkg/command/storagemetadata.go index 2e87bea4f0..2965c36cfc 100644 --- a/ocis/pkg/command/storagemetadata.go +++ b/ocis/pkg/command/storagemetadata.go @@ -1,8 +1,11 @@ package command import ( + "fmt" + "github.com/owncloud/ocis/extensions/storage-metadata/pkg/command" "github.com/owncloud/ocis/ocis-pkg/config" + "github.com/owncloud/ocis/ocis-pkg/config/parser" "github.com/owncloud/ocis/ocis/pkg/register" "github.com/urfave/cli/v2" ) @@ -13,6 +16,14 @@ func StorageMetadataCommand(cfg *config.Config) *cli.Command { Name: "storage-metadata", Usage: "start storage and data service for metadata", Category: "extensions", + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { + fmt.Printf("%v", err) + return err + } + cfg.StorageMetadata.Commons = cfg.Commons + return nil + }, Action: func(c *cli.Context) error { origCmd := command.StorageMetadata(cfg.StorageMetadata) return handleOriginalAction(c, origCmd) diff --git a/ocis/pkg/command/storagepubliclink.go b/ocis/pkg/command/storagepubliclink.go index 06a99d0a7a..fe2f8b75e8 100644 --- a/ocis/pkg/command/storagepubliclink.go +++ b/ocis/pkg/command/storagepubliclink.go @@ -1,8 +1,11 @@ package command import ( + "fmt" + "github.com/owncloud/ocis/extensions/storage-publiclink/pkg/command" "github.com/owncloud/ocis/ocis-pkg/config" + "github.com/owncloud/ocis/ocis-pkg/config/parser" "github.com/owncloud/ocis/ocis/pkg/register" "github.com/urfave/cli/v2" ) @@ -13,6 +16,14 @@ func StoragePublicLinkCommand(cfg *config.Config) *cli.Command { Name: "storage-public-link", Usage: "start storage public link storage", Category: "extensions", + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { + fmt.Printf("%v", err) + return err + } + cfg.StoragePublicLink.Commons = cfg.Commons + return nil + }, Action: func(c *cli.Context) error { origCmd := command.StoragePublicLink(cfg.StoragePublicLink) return handleOriginalAction(c, origCmd) diff --git a/ocis/pkg/command/storageshares.go b/ocis/pkg/command/storageshares.go index 04fe859bd0..62f13c38a8 100644 --- a/ocis/pkg/command/storageshares.go +++ b/ocis/pkg/command/storageshares.go @@ -1,8 +1,11 @@ package command import ( + "fmt" + "github.com/owncloud/ocis/extensions/storage-shares/pkg/command" "github.com/owncloud/ocis/ocis-pkg/config" + "github.com/owncloud/ocis/ocis-pkg/config/parser" "github.com/owncloud/ocis/ocis/pkg/register" "github.com/urfave/cli/v2" ) @@ -13,6 +16,14 @@ func StorageSharesCommand(cfg *config.Config) *cli.Command { Name: "storage-shares", Usage: "start storage and data provider for shares jail", Category: "extensions", + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { + fmt.Printf("%v", err) + return err + } + cfg.StorageShares.Commons = cfg.Commons + return nil + }, Action: func(c *cli.Context) error { origCmd := command.StorageShares(cfg.StorageShares) return handleOriginalAction(c, origCmd) diff --git a/ocis/pkg/command/storagesharing.go b/ocis/pkg/command/storagesharing.go index fe9e3cb796..63c7e2aa06 100644 --- a/ocis/pkg/command/storagesharing.go +++ b/ocis/pkg/command/storagesharing.go @@ -1,8 +1,11 @@ package command import ( + "fmt" + "github.com/owncloud/ocis/extensions/sharing/pkg/command" "github.com/owncloud/ocis/ocis-pkg/config" + "github.com/owncloud/ocis/ocis-pkg/config/parser" "github.com/owncloud/ocis/ocis/pkg/register" "github.com/urfave/cli/v2" ) @@ -13,6 +16,14 @@ func StorageSharingCommand(cfg *config.Config) *cli.Command { Name: "storage-sharing", Usage: "start storage sharing service", Category: "extensions", + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { + fmt.Printf("%v", err) + return err + } + cfg.Sharing.Commons = cfg.Commons + return nil + }, Action: func(c *cli.Context) error { origCmd := command.Sharing(cfg.Sharing) return handleOriginalAction(c, origCmd) diff --git a/ocis/pkg/command/storageuserprovider.go b/ocis/pkg/command/storageuserprovider.go index dabef25fb0..5e3af09569 100644 --- a/ocis/pkg/command/storageuserprovider.go +++ b/ocis/pkg/command/storageuserprovider.go @@ -1,8 +1,11 @@ package command import ( + "fmt" + "github.com/owncloud/ocis/extensions/user/pkg/command" "github.com/owncloud/ocis/ocis-pkg/config" + "github.com/owncloud/ocis/ocis-pkg/config/parser" "github.com/owncloud/ocis/ocis/pkg/register" "github.com/urfave/cli/v2" ) @@ -13,6 +16,14 @@ func StorageUserProviderCommand(cfg *config.Config) *cli.Command { Name: "storage-userprovider", Usage: "start storage userprovider service", Category: "extensions", + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { + fmt.Printf("%v", err) + return err + } + cfg.StorageUsers.Commons = cfg.Commons + return nil + }, Action: func(c *cli.Context) error { origCmd := command.User(cfg.User) return handleOriginalAction(c, origCmd) diff --git a/ocis/pkg/command/store.go b/ocis/pkg/command/store.go index 12bda770f9..50d1f92cdd 100644 --- a/ocis/pkg/command/store.go +++ b/ocis/pkg/command/store.go @@ -17,12 +17,13 @@ func StoreCommand(cfg *config.Config) *cli.Command { Name: cfg.Store.Service.Name, Usage: subcommandDescription(cfg.Store.Service.Name), Category: "extensions", - Before: func(ctx *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { fmt.Printf("%v", err) + return err } - return err + cfg.Store.Commons = cfg.Commons + return nil }, Subcommands: command.GetCommands(cfg.Store), } diff --git a/ocis/pkg/command/thumbnails.go b/ocis/pkg/command/thumbnails.go index ca6e693a02..6b888fb177 100644 --- a/ocis/pkg/command/thumbnails.go +++ b/ocis/pkg/command/thumbnails.go @@ -16,12 +16,13 @@ func ThumbnailsCommand(cfg *config.Config) *cli.Command { Name: cfg.Thumbnails.Service.Name, Usage: subcommandDescription(cfg.Thumbnails.Service.Name), Category: "extensions", - Before: func(ctx *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { fmt.Printf("%v", err) + return err } - return err + cfg.Thumbnails.Commons = cfg.Commons + return nil }, Subcommands: command.GetCommands(cfg.Thumbnails), } diff --git a/ocis/pkg/command/web.go b/ocis/pkg/command/web.go index 70499da3fe..d3e93e4b07 100644 --- a/ocis/pkg/command/web.go +++ b/ocis/pkg/command/web.go @@ -16,12 +16,13 @@ func WebCommand(cfg *config.Config) *cli.Command { Name: cfg.Web.Service.Name, Usage: subcommandDescription(cfg.Web.Service.Name), Category: "extensions", - Before: func(ctx *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { fmt.Printf("%v", err) + return err } - return err + cfg.Web.Commons = cfg.Commons + return nil }, Subcommands: command.GetCommands(cfg.Web), } diff --git a/ocis/pkg/command/webdav.go b/ocis/pkg/command/webdav.go index a87145ab4e..693f237d8a 100644 --- a/ocis/pkg/command/webdav.go +++ b/ocis/pkg/command/webdav.go @@ -17,12 +17,13 @@ func WebDAVCommand(cfg *config.Config) *cli.Command { Name: cfg.WebDAV.Service.Name, Usage: subcommandDescription(cfg.WebDAV.Service.Name), Category: "extensions", - Before: func(ctx *cli.Context) error { - err := parser.ParseConfig(cfg) - if err != nil { + Before: func(c *cli.Context) error { + if err := parser.ParseConfig(cfg); err != nil { fmt.Printf("%v", err) + return err } - return err + cfg.WebDAV.Commons = cfg.Commons + return nil }, Subcommands: command.GetCommands(cfg.WebDAV), }