Rename ocis-phoenix to ocis-web
This commit is contained in:
+20
-20
@@ -4,54 +4,54 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/owncloud/ocis/ocis-phoenix/pkg/command"
|
||||
"github.com/owncloud/ocis/ocis-phoenix/pkg/flagset"
|
||||
"github.com/owncloud/ocis/ocis/pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/web/pkg/command"
|
||||
"github.com/owncloud/ocis/web/pkg/flagset"
|
||||
)
|
||||
|
||||
// PhoenixCommand is the entrypoint for the phoenix command.
|
||||
func PhoenixCommand(cfg *config.Config) *cli.Command {
|
||||
// WebCommand is the entrypoint for the web command.
|
||||
func WebCommand(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "phoenix",
|
||||
Usage: "Start phoenix server",
|
||||
Name: "web",
|
||||
Usage: "Start web server",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.ServerWithConfig(cfg.Phoenix),
|
||||
Flags: flagset.ServerWithConfig(cfg.Web),
|
||||
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")
|
||||
cfg.Web.Web.Config.Apps = c.StringSlice("web-config-app")
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
phoenixCommand := command.Server(configurePhoenix(cfg).Phoenix)
|
||||
webCommand := command.Server(configureWeb(cfg).Web)
|
||||
|
||||
if err := phoenixCommand.Before(c); err != nil {
|
||||
if err := webCommand.Before(c); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return cli.HandleAction(phoenixCommand.Action, c)
|
||||
return cli.HandleAction(webCommand.Action, c)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configurePhoenix(cfg *config.Config) *config.Config {
|
||||
cfg.Phoenix.Log.Level = cfg.Log.Level
|
||||
cfg.Phoenix.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Phoenix.Log.Color = cfg.Log.Color
|
||||
func configureWeb(cfg *config.Config) *config.Config {
|
||||
cfg.Web.Log.Level = cfg.Log.Level
|
||||
cfg.Web.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Web.Log.Color = cfg.Log.Color
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Phoenix.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Phoenix.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Phoenix.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Phoenix.Tracing.Collector = cfg.Tracing.Collector
|
||||
cfg.Web.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Web.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Web.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Web.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(PhoenixCommand)
|
||||
register.AddCommand(WebCommand)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user