Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unify ocis subcommands #3796

Merged
merged 1 commit into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions changelog/unreleased/fix-search-command-server-command.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Bugfix: Fix the `ocis search` command

We've fixed the behavior for `ocis search`, which didn't show further help when not all secrets have been configured.
It also was not possible to start the search service standalone from the oCIS binary without configuring all oCIS secrets,
even they were not needed by the search service.

https://github.com/owncloud/ocis/pull/3796

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/owncloud/ocis/v2/extensions/app-provider/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
Expand All @@ -14,7 +15,7 @@ import (
func AppProviderCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: cfg.AppProvider.Service.Name,
Usage: subcommandDescription(cfg.AppProvider.Service.Name),
Usage: helper.SubcommandDescription(cfg.AppProvider.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion ocis/pkg/command/app-registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/owncloud/ocis/v2/extensions/app-registry/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
Expand All @@ -14,7 +15,7 @@ import (
func AppRegistryCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: cfg.AppRegistry.Service.Name,
Usage: subcommandDescription(cfg.AppRegistry.Service.Name),
Usage: helper.SubcommandDescription(cfg.AppRegistry.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
7 changes: 4 additions & 3 deletions ocis/pkg/command/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import (
"github.com/owncloud/ocis/v2/extensions/audit/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)

// AuditCommand is the entrypoint for the audit command.
// AuditCommand is the entrypoint for the Audit command.
func AuditCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "audit",
Usage: "start audit service",
Name: cfg.Audit.Service.Name,
Usage: helper.SubcommandDescription(cfg.Audit.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion ocis/pkg/command/auth-basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/owncloud/ocis/v2/extensions/auth-basic/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
Expand All @@ -14,7 +15,7 @@ import (
func AuthBasicCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: cfg.AuthBasic.Service.Name,
Usage: subcommandDescription(cfg.AuthBasic.Service.Name),
Usage: helper.SubcommandDescription(cfg.AuthBasic.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion ocis/pkg/command/auth-bearer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/owncloud/ocis/v2/extensions/auth-bearer/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
Expand All @@ -14,7 +15,7 @@ import (
func AuthBearerCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: cfg.AuthBearer.Service.Name,
Usage: subcommandDescription(cfg.AuthBearer.Service.Name),
Usage: helper.SubcommandDescription(cfg.AuthBearer.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion ocis/pkg/command/auth-machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/owncloud/ocis/v2/extensions/auth-machine/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
Expand All @@ -14,7 +15,7 @@ import (
func AuthMachineCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: cfg.AuthMachine.Service.Name,
Usage: subcommandDescription(cfg.AuthMachine.Service.Name),
Usage: helper.SubcommandDescription(cfg.AuthMachine.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion ocis/pkg/command/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/owncloud/ocis/v2/extensions/frontend/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
Expand All @@ -14,7 +15,7 @@ import (
func FrontendCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: cfg.Frontend.Service.Name,
Usage: subcommandDescription(cfg.Frontend.Service.Name),
Usage: helper.SubcommandDescription(cfg.Frontend.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion ocis/pkg/command/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/owncloud/ocis/v2/extensions/gateway/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
Expand All @@ -14,7 +15,7 @@ import (
func GatewayCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: cfg.Gateway.Service.Name,
Usage: subcommandDescription(cfg.Gateway.Service.Name),
Usage: helper.SubcommandDescription(cfg.Gateway.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/owncloud/ocis/v2/extensions/graph-explorer/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
Expand All @@ -14,7 +15,7 @@ import (
func GraphExplorerCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: cfg.GraphExplorer.Service.Name,
Usage: subcommandDescription(cfg.GraphExplorer.Service.Name),
Usage: helper.SubcommandDescription(cfg.GraphExplorer.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion ocis/pkg/command/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/owncloud/ocis/v2/extensions/graph/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
Expand All @@ -14,7 +15,7 @@ import (
func GraphCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: cfg.Graph.Service.Name,
Usage: subcommandDescription(cfg.Graph.Service.Name),
Usage: helper.SubcommandDescription(cfg.Graph.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion ocis/pkg/command/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/owncloud/ocis/v2/extensions/groups/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
Expand All @@ -14,7 +15,7 @@ import (
func GroupsCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: cfg.Groups.Service.Name,
Usage: subcommandDescription(cfg.Groups.Service.Name),
Usage: helper.SubcommandDescription(cfg.Groups.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package command
package helper

import (
"fmt"
)

func subcommandDescription(serviceName string) string {
func SubcommandDescription(serviceName string) string {
return fmt.Sprintf("%s extension commands", serviceName)
}
7 changes: 4 additions & 3 deletions ocis/pkg/command/idm.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import (
"github.com/owncloud/ocis/v2/extensions/idm/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)

// IDMCommand is the entrypoint for the idm server command.
// IDMCommand is the entrypoint for the idm command.
func IDMCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "idm",
Usage: "idm extension commands",
Name: cfg.IDM.Service.Name,
Usage: helper.SubcommandDescription(cfg.IDM.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion ocis/pkg/command/idp.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/owncloud/ocis/v2/extensions/idp/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
Expand All @@ -14,7 +15,7 @@ import (
func IDPCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: cfg.IDP.Service.Name,
Usage: subcommandDescription(cfg.IDP.Service.Name),
Usage: helper.SubcommandDescription(cfg.IDP.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion ocis/pkg/command/natsserver.go → ocis/pkg/command/nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/owncloud/ocis/v2/extensions/nats/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
Expand All @@ -14,7 +15,7 @@ import (
func NatsCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: cfg.Nats.Service.Name,
Usage: subcommandDescription(cfg.Nats.Service.Name),
Usage: helper.SubcommandDescription(cfg.Nats.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
7 changes: 4 additions & 3 deletions ocis/pkg/command/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import (
"github.com/owncloud/ocis/v2/extensions/notifications/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)

// NatsServerCommand is the entrypoint for the nats server command.
// NotificationsCommand is the entrypoint for the notifications command.
func NotificationsCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "notifications",
Usage: "start notifications service",
Name: cfg.Notifications.Service.Name,
Usage: helper.SubcommandDescription(cfg.Notifications.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion ocis/pkg/command/ocdav.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/owncloud/ocis/v2/extensions/ocdav/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
Expand All @@ -14,7 +15,7 @@ import (
func OCDavCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: cfg.OCDav.Service.Name,
Usage: subcommandDescription(cfg.OCDav.Service.Name),
Usage: helper.SubcommandDescription(cfg.OCDav.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion ocis/pkg/command/ocs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/owncloud/ocis/v2/extensions/ocs/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
Expand All @@ -14,7 +15,7 @@ import (
func OCSCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: cfg.OCS.Service.Name,
Usage: subcommandDescription(cfg.OCS.Service.Name),
Usage: helper.SubcommandDescription(cfg.OCS.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion ocis/pkg/command/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/owncloud/ocis/v2/extensions/proxy/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
Expand All @@ -14,7 +15,7 @@ import (
func ProxyCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: cfg.Proxy.Service.Name,
Usage: subcommandDescription(cfg.Proxy.Service.Name),
Usage: helper.SubcommandDescription(cfg.Proxy.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion ocis/pkg/command/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func Execute() error {

app := clihelper.DefaultApp(&cli.App{
Name: "ocis",
Usage: "ownCloud Infinite Scale Stack",
Usage: "ownCloud Infinite Scale",
})

for _, fn := range register.Commands {
Expand Down
13 changes: 10 additions & 3 deletions ocis/pkg/command/search.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package command

import (
"fmt"

"github.com/owncloud/ocis/v2/extensions/search/pkg/command"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/command/helper"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
Expand All @@ -12,10 +15,14 @@ import (
func SearchCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: cfg.Search.Service.Name,
Usage: subcommandDescription(cfg.Search.Service.Name),
Usage: helper.SubcommandDescription(cfg.Search.Service.Name),
Category: "extensions",
Before: func(ctx *cli.Context) error {
return parser.ParseConfig(cfg)
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
fmt.Printf("%v", err)
}
cfg.Search.Commons = cfg.Commons
return nil
},
Subcommands: command.GetCommands(cfg.Search),
}
Expand Down
6 changes: 3 additions & 3 deletions ocis/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ func Server(cfg *config.Config) *cli.Command {
Usage: "start a fullstack server (runtime and all extensions in supervised mode)",
Category: "fullstack",
Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg)
if err != nil {
if err := parser.ParseConfig(cfg); err != nil {
fmt.Printf("%v", err)
return err
}
return err
return nil
},
Action: func(c *cli.Context) error {
r := runtime.New(cfg)
Expand Down
Loading