mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-31 01:10:20 -06:00
43 lines
1.0 KiB
Go
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)
|
|
}
|