diff --git a/opencloud/pkg/command/server.go b/opencloud/pkg/command/server.go index 8ed88f065..68f6aa018 100644 --- a/opencloud/pkg/command/server.go +++ b/opencloud/pkg/command/server.go @@ -6,22 +6,22 @@ import ( "github.com/opencloud-eu/opencloud/pkg/config" "github.com/opencloud-eu/opencloud/pkg/config/configlog" "github.com/opencloud-eu/opencloud/pkg/config/parser" - "github.com/urfave/cli/v2" + + "github.com/spf13/cobra" ) // Server is the entrypoint for the server command. -func Server(cfg *config.Config) *cli.Command { - return &cli.Command{ - Name: "server", - Usage: "start a fullstack server (runtime and all services in supervised mode)", - Category: "fullstack", - Before: func(c *cli.Context) error { +func Server(cfg *config.Config) *cobra.Command { + return &cobra.Command{ + Use: "server", + Short: "start a fullstack server (runtime and all services in supervised mode)", + PreRunE: func(cmd *cobra.Command, args []string) error { return configlog.ReturnError(parser.ParseConfig(cfg, false)) }, - Action: func(c *cli.Context) error { + RunE: func(cmd *cobra.Command, args []string) error { // Prefer the in-memory registry as the default when running in single-binary mode r := runtime.New(cfg) - return r.Start(c.Context) + return r.Start(cmd.Context()) }, } }