Files
opencloud/pkg/command/phoenix.go
2020-03-17 15:01:09 +01:00

43 lines
1.0 KiB
Go

package command
import (
"strings"
"github.com/micro/cli/v2"
"github.com/owncloud/ocis-phoenix/pkg/command"
"github.com/owncloud/ocis-phoenix/pkg/flagset"
"github.com/owncloud/ocis/pkg/config"
"github.com/owncloud/ocis/pkg/register"
)
// PhoenixCommand is the entrypoint for the phoenix command.
func PhoenixCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "phoenix",
Usage: "Start phoenix server",
Category: "Extensions",
Flags: flagset.ServerWithConfig(cfg.Phoenix),
Before: func(c *cli.Context) error {
if cfg.HTTP.Root != "/" {
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
}
cfg.Phoenix.Phoenix.Config.Apps = c.StringSlice("web-config-app")
return nil
},
Action: func(c *cli.Context) error {
phoenixCommand := command.Server(configurePhoenix(cfg))
if err := phoenixCommand.Before(c); err != nil {
return err
}
return cli.HandleAction(phoenixCommand.Action, c)
},
}
}
func init() {
register.AddCommand(PhoenixCommand)
}