From 45f49aec1e06611bfb60211f1f9e768e96d45c8c Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Tue, 19 Apr 2022 15:26:08 +0200 Subject: [PATCH] fix config parsing in unsupervised mode --- ocis/pkg/command/accounts.go | 10 +++------- ocis/pkg/command/audit.go | 10 +++------- ocis/pkg/command/glauth.go | 10 +++------- ocis/pkg/command/graph.go | 10 +++------- ocis/pkg/command/graphexplorer.go | 4 ---- ocis/pkg/command/idm.go | 10 +++------- ocis/pkg/command/idp.go | 10 +++------- ocis/pkg/command/natsserver.go | 10 +++------- ocis/pkg/command/notifications.go | 10 +++------- ocis/pkg/command/ocs.go | 10 +++------- ocis/pkg/command/proxy.go | 10 +++------- ocis/pkg/command/server.go | 2 +- ocis/pkg/command/settings.go | 10 +++------- ocis/pkg/command/store.go | 10 +++------- ocis/pkg/command/thumbnails.go | 10 +++------- ocis/pkg/command/web.go | 10 +++------- ocis/pkg/command/webdav.go | 10 +++------- 17 files changed, 46 insertions(+), 110 deletions(-) diff --git a/ocis/pkg/command/accounts.go b/ocis/pkg/command/accounts.go index f8a56bfcc5b..71176908853 100644 --- a/ocis/pkg/command/accounts.go +++ b/ocis/pkg/command/accounts.go @@ -3,7 +3,6 @@ package command import ( "github.com/owncloud/ocis/extensions/accounts/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" ) @@ -11,12 +10,9 @@ import ( // AccountsCommand is the entrypoint for the accounts command. func AccountsCommand(cfg *config.Config) *cli.Command { return &cli.Command{ - Name: cfg.Accounts.Service.Name, - Usage: subcommandDescription(cfg.Accounts.Service.Name), - Category: "extensions", - Before: func(ctx *cli.Context) error { - return parser.ParseConfig(cfg) - }, + Name: cfg.Accounts.Service.Name, + Usage: subcommandDescription(cfg.Accounts.Service.Name), + Category: "extensions", Subcommands: command.GetCommands(cfg.Accounts), } } diff --git a/ocis/pkg/command/audit.go b/ocis/pkg/command/audit.go index 638367a166b..91522a6b00b 100644 --- a/ocis/pkg/command/audit.go +++ b/ocis/pkg/command/audit.go @@ -3,7 +3,6 @@ package command import ( "github.com/owncloud/ocis/extensions/audit/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" ) @@ -11,12 +10,9 @@ import ( // AuditCommand is the entrypoint for the audit command. func AuditCommand(cfg *config.Config) *cli.Command { return &cli.Command{ - Name: "audit", - Usage: "start audit service", - Category: "extensions", - Before: func(ctx *cli.Context) error { - return parser.ParseConfig(cfg) - }, + Name: cfg.Audit.Service.Name, + Usage: subcommandDescription(cfg.Audit.Service.Name), + Category: "extensions", Subcommands: command.GetCommands(cfg.Audit), } } diff --git a/ocis/pkg/command/glauth.go b/ocis/pkg/command/glauth.go index ad91954eb03..e56e9e33a50 100644 --- a/ocis/pkg/command/glauth.go +++ b/ocis/pkg/command/glauth.go @@ -3,7 +3,6 @@ package command import ( "github.com/owncloud/ocis/extensions/glauth/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" ) @@ -11,12 +10,9 @@ import ( // GLAuthCommand is the entrypoint for the glauth command. func GLAuthCommand(cfg *config.Config) *cli.Command { return &cli.Command{ - Name: cfg.GLAuth.Service.Name, - Usage: subcommandDescription(cfg.GLAuth.Service.Name), - Category: "extensions", - Before: func(ctx *cli.Context) error { - return parser.ParseConfig(cfg) - }, + Name: cfg.GLAuth.Service.Name, + Usage: subcommandDescription(cfg.GLAuth.Service.Name), + Category: "extensions", Subcommands: command.GetCommands(cfg.GLAuth), } } diff --git a/ocis/pkg/command/graph.go b/ocis/pkg/command/graph.go index 836ad44465d..7cc90d3dacb 100644 --- a/ocis/pkg/command/graph.go +++ b/ocis/pkg/command/graph.go @@ -3,7 +3,6 @@ package command import ( "github.com/owncloud/ocis/extensions/graph/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" ) @@ -11,12 +10,9 @@ import ( // GraphCommand is the entrypoint for the graph command. func GraphCommand(cfg *config.Config) *cli.Command { return &cli.Command{ - Name: cfg.Graph.Service.Name, - Usage: subcommandDescription(cfg.Graph.Service.Name), - Category: "extensions", - Before: func(ctx *cli.Context) error { - return parser.ParseConfig(cfg) - }, + Name: cfg.Graph.Service.Name, + Usage: subcommandDescription(cfg.Graph.Service.Name), + Category: "extensions", Subcommands: command.GetCommands(cfg.Graph), } } diff --git a/ocis/pkg/command/graphexplorer.go b/ocis/pkg/command/graphexplorer.go index 95be9e503ff..d9f6b198b7b 100644 --- a/ocis/pkg/command/graphexplorer.go +++ b/ocis/pkg/command/graphexplorer.go @@ -3,7 +3,6 @@ package command import ( "github.com/owncloud/ocis/extensions/graph-explorer/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" ) @@ -14,9 +13,6 @@ 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 { - return parser.ParseConfig(cfg) - }, Subcommands: command.GetCommands(cfg.GraphExplorer), } } diff --git a/ocis/pkg/command/idm.go b/ocis/pkg/command/idm.go index d768b6dc58b..a4f86ac5d25 100644 --- a/ocis/pkg/command/idm.go +++ b/ocis/pkg/command/idm.go @@ -3,7 +3,6 @@ package command import ( "github.com/owncloud/ocis/extensions/idm/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" ) @@ -11,12 +10,9 @@ import ( // IDMCommand is the entrypoint for the idm server command. func IDMCommand(cfg *config.Config) *cli.Command { return &cli.Command{ - Name: "idm", - Usage: "idm extension commands", - Category: "extensions", - Before: func(ctx *cli.Context) error { - return parser.ParseConfig(cfg) - }, + Name: "idm", + Usage: "idm extension commands", + Category: "extensions", Subcommands: command.GetCommands(cfg.IDM), } } diff --git a/ocis/pkg/command/idp.go b/ocis/pkg/command/idp.go index 0c6828c5928..5b948907695 100644 --- a/ocis/pkg/command/idp.go +++ b/ocis/pkg/command/idp.go @@ -3,7 +3,6 @@ package command import ( "github.com/owncloud/ocis/extensions/idp/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" ) @@ -11,12 +10,9 @@ import ( // IDPCommand is the entrypoint for the idp command. func IDPCommand(cfg *config.Config) *cli.Command { return &cli.Command{ - Name: cfg.IDP.Service.Name, - Usage: subcommandDescription(cfg.IDP.Service.Name), - Category: "extensions", - Before: func(ctx *cli.Context) error { - return parser.ParseConfig(cfg) - }, + Name: cfg.IDP.Service.Name, + Usage: subcommandDescription(cfg.IDP.Service.Name), + Category: "extensions", Subcommands: command.GetCommands(cfg.IDP), } } diff --git a/ocis/pkg/command/natsserver.go b/ocis/pkg/command/natsserver.go index 1e7f3432317..334412fd1b8 100644 --- a/ocis/pkg/command/natsserver.go +++ b/ocis/pkg/command/natsserver.go @@ -3,7 +3,6 @@ package command import ( "github.com/owncloud/ocis/extensions/nats/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" ) @@ -11,12 +10,9 @@ import ( // NatsServerCommand is the entrypoint for the nats server command. func NatsServerCommand(cfg *config.Config) *cli.Command { return &cli.Command{ - Name: "nats-server", - Usage: "start nats server", - Category: "extensions", - Before: func(ctx *cli.Context) error { - return parser.ParseConfig(cfg) - }, + Name: "nats-server", + Usage: "start nats server", + Category: "extensions", Subcommands: command.GetCommands(cfg.Nats), } } diff --git a/ocis/pkg/command/notifications.go b/ocis/pkg/command/notifications.go index f4108e299af..fb16c3f9ac8 100644 --- a/ocis/pkg/command/notifications.go +++ b/ocis/pkg/command/notifications.go @@ -3,7 +3,6 @@ package command import ( "github.com/owncloud/ocis/extensions/notifications/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" ) @@ -11,12 +10,9 @@ import ( // NatsServerCommand is the entrypoint for the nats server command. func NotificationsCommand(cfg *config.Config) *cli.Command { return &cli.Command{ - Name: "notifications", - Usage: "start notifications service", - Category: "extensions", - Before: func(ctx *cli.Context) error { - return parser.ParseConfig(cfg) - }, + Name: "notifications", + Usage: "start notifications service", + Category: "extensions", Subcommands: command.GetCommands(cfg.Notifications), } } diff --git a/ocis/pkg/command/ocs.go b/ocis/pkg/command/ocs.go index 2fae3beb95d..ee31837e995 100644 --- a/ocis/pkg/command/ocs.go +++ b/ocis/pkg/command/ocs.go @@ -3,7 +3,6 @@ package command import ( "github.com/owncloud/ocis/extensions/ocs/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" ) @@ -11,12 +10,9 @@ import ( // OCSCommand is the entrypoint for the ocs command. func OCSCommand(cfg *config.Config) *cli.Command { return &cli.Command{ - Name: cfg.OCS.Service.Name, - Usage: subcommandDescription(cfg.OCS.Service.Name), - Category: "extensions", - Before: func(ctx *cli.Context) error { - return parser.ParseConfig(cfg) - }, + Name: cfg.OCS.Service.Name, + Usage: subcommandDescription(cfg.OCS.Service.Name), + Category: "extensions", Subcommands: command.GetCommands(cfg.OCS), } } diff --git a/ocis/pkg/command/proxy.go b/ocis/pkg/command/proxy.go index 429ca83e19f..c72387543af 100644 --- a/ocis/pkg/command/proxy.go +++ b/ocis/pkg/command/proxy.go @@ -3,7 +3,6 @@ package command import ( "github.com/owncloud/ocis/extensions/proxy/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" ) @@ -11,12 +10,9 @@ import ( // ProxyCommand is the entry point for the proxy command. func ProxyCommand(cfg *config.Config) *cli.Command { return &cli.Command{ - Name: cfg.Proxy.Service.Name, - Usage: subcommandDescription(cfg.Proxy.Service.Name), - Category: "extensions", - Before: func(ctx *cli.Context) error { - return parser.ParseConfig(cfg) - }, + Name: cfg.Proxy.Service.Name, + Usage: subcommandDescription(cfg.Proxy.Service.Name), + Category: "extensions", Subcommands: command.GetCommands(cfg.Proxy), } } diff --git a/ocis/pkg/command/server.go b/ocis/pkg/command/server.go index caa54d341a8..e6479a731c5 100644 --- a/ocis/pkg/command/server.go +++ b/ocis/pkg/command/server.go @@ -20,7 +20,7 @@ func Server(cfg *config.Config) *cli.Command { &cli.StringFlag{ Name: "config-file", Value: cfg.ConfigFile, - Usage: "config file to be loaded by the extension", + Usage: "config file to be loaded by the oCIS runtime", Destination: &cfg.ConfigFile, }, }, diff --git a/ocis/pkg/command/settings.go b/ocis/pkg/command/settings.go index 32c8b43e690..b59140a6e47 100644 --- a/ocis/pkg/command/settings.go +++ b/ocis/pkg/command/settings.go @@ -3,7 +3,6 @@ package command import ( "github.com/owncloud/ocis/extensions/settings/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" ) @@ -11,12 +10,9 @@ import ( // SettingsCommand is the entry point for the settings command. func SettingsCommand(cfg *config.Config) *cli.Command { return &cli.Command{ - Name: cfg.Settings.Service.Name, - Usage: subcommandDescription(cfg.Settings.Service.Name), - Category: "extensions", - Before: func(ctx *cli.Context) error { - return parser.ParseConfig(cfg) - }, + Name: cfg.Settings.Service.Name, + Usage: subcommandDescription(cfg.Settings.Service.Name), + Category: "extensions", Subcommands: command.GetCommands(cfg.Settings), } } diff --git a/ocis/pkg/command/store.go b/ocis/pkg/command/store.go index e37d5ab79f1..239a8f3dcab 100644 --- a/ocis/pkg/command/store.go +++ b/ocis/pkg/command/store.go @@ -3,7 +3,6 @@ package command import ( "github.com/owncloud/ocis/extensions/store/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" ) @@ -12,12 +11,9 @@ import ( func StoreCommand(cfg *config.Config) *cli.Command { return &cli.Command{ - Name: cfg.Store.Service.Name, - Usage: subcommandDescription(cfg.Store.Service.Name), - Category: "extensions", - Before: func(ctx *cli.Context) error { - return parser.ParseConfig(cfg) - }, + Name: cfg.Store.Service.Name, + Usage: subcommandDescription(cfg.Store.Service.Name), + Category: "extensions", Subcommands: command.GetCommands(cfg.Store), } } diff --git a/ocis/pkg/command/thumbnails.go b/ocis/pkg/command/thumbnails.go index 8409c98dc07..68cb54559e9 100644 --- a/ocis/pkg/command/thumbnails.go +++ b/ocis/pkg/command/thumbnails.go @@ -3,7 +3,6 @@ package command import ( "github.com/owncloud/ocis/extensions/thumbnails/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" ) @@ -11,12 +10,9 @@ import ( // ThumbnailsCommand is the entrypoint for the thumbnails command. func ThumbnailsCommand(cfg *config.Config) *cli.Command { return &cli.Command{ - Name: cfg.Thumbnails.Service.Name, - Usage: subcommandDescription(cfg.Thumbnails.Service.Name), - Category: "extensions", - Before: func(ctx *cli.Context) error { - return parser.ParseConfig(cfg) - }, + Name: cfg.Thumbnails.Service.Name, + Usage: subcommandDescription(cfg.Thumbnails.Service.Name), + Category: "extensions", Subcommands: command.GetCommands(cfg.Thumbnails), } } diff --git a/ocis/pkg/command/web.go b/ocis/pkg/command/web.go index 0b3ec822e24..e4f6e3cbf38 100644 --- a/ocis/pkg/command/web.go +++ b/ocis/pkg/command/web.go @@ -3,7 +3,6 @@ package command import ( "github.com/owncloud/ocis/extensions/web/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" ) @@ -11,12 +10,9 @@ import ( // WebCommand is the entrypoint for the web command. func WebCommand(cfg *config.Config) *cli.Command { return &cli.Command{ - Name: cfg.Web.Service.Name, - Usage: subcommandDescription(cfg.Web.Service.Name), - Category: "extensions", - Before: func(ctx *cli.Context) error { - return parser.ParseConfig(cfg) - }, + Name: cfg.Web.Service.Name, + Usage: subcommandDescription(cfg.Web.Service.Name), + Category: "extensions", Subcommands: command.GetCommands(cfg.Web), } } diff --git a/ocis/pkg/command/webdav.go b/ocis/pkg/command/webdav.go index 7add32497fa..56ceb624d81 100644 --- a/ocis/pkg/command/webdav.go +++ b/ocis/pkg/command/webdav.go @@ -3,7 +3,6 @@ package command import ( "github.com/owncloud/ocis/extensions/webdav/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" ) @@ -12,12 +11,9 @@ import ( func WebDAVCommand(cfg *config.Config) *cli.Command { return &cli.Command{ - Name: cfg.WebDAV.Service.Name, - Usage: subcommandDescription(cfg.WebDAV.Service.Name), - Category: "extensions", - Before: func(ctx *cli.Context) error { - return parser.ParseConfig(cfg) - }, + Name: cfg.WebDAV.Service.Name, + Usage: subcommandDescription(cfg.WebDAV.Service.Name), + Category: "extensions", Subcommands: command.GetCommands(cfg.WebDAV), } }