Files
ocis/pkg/command/server_simple.go
T

53 lines
1.2 KiB
Go
Raw Normal View History

2020-01-09 14:34:08 +01:00
// +build simple
package command
import (
"strings"
2020-02-10 17:04:40 +01:00
"github.com/micro/cli/v2"
2020-01-09 14:34:08 +01:00
"github.com/owncloud/ocis/pkg/config"
"github.com/owncloud/ocis/pkg/flagset"
"github.com/owncloud/ocis/pkg/register"
2020-06-04 11:45:19 +02:00
"github.com/owncloud/ocis/pkg/runtime"
2020-01-10 11:48:09 +01:00
"github.com/owncloud/ocis/pkg/tracing"
2020-01-09 14:34:08 +01:00
)
2020-01-10 11:59:19 +01:00
var (
2020-03-31 08:22:34 +02:00
// SimpleRuntimeServices declares which services will be started for the simple server
2020-01-16 22:34:25 +01:00
SimpleRuntimeServices = []string{
"hello",
"phoenix",
2020-03-31 08:22:34 +02:00
"konnectd",
"glauth",
2020-01-16 22:34:25 +01:00
}
2020-01-10 11:59:19 +01:00
)
// Simple is the entrypoint for the server command. It is the `ocis server` subcommand overloaded with a different set of services
2020-02-10 17:04:40 +01:00
func Simple(cfg *config.Config) *cli.Command {
return &cli.Command{
2020-01-09 14:34:08 +01:00
Name: "server",
Usage: "Start fullstack server",
Category: "Fullstack",
Flags: flagset.ServerWithConfig(cfg),
Before: func(c *cli.Context) error {
if cfg.HTTP.Root != "/" {
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
}
return nil
},
Action: func(c *cli.Context) error {
2020-01-10 11:51:03 +01:00
if err := tracing.Start(cfg); err != nil {
2020-01-10 11:48:09 +01:00
return err
2020-01-09 14:34:08 +01:00
}
2020-06-04 12:27:40 +02:00
r := runtime.New()
return r.Start(append(SimpleRuntimeServices, runtime.MicroServices...)...)
2020-01-09 14:34:08 +01:00
},
}
}
func init() {
register.AddCommand(Simple)
}