Files
ocis/pkg/command/graph.go
T

43 lines
1.0 KiB
Go
Raw Normal View History

2020-01-09 14:33:44 +01:00
// +build !simple
package command
import (
2020-02-10 17:04:40 +01:00
"github.com/micro/cli/v2"
"github.com/owncloud/ocis-graph/pkg/command"
svcconfig "github.com/owncloud/ocis-graph/pkg/config"
"github.com/owncloud/ocis-graph/pkg/flagset"
"github.com/owncloud/ocis/pkg/config"
"github.com/owncloud/ocis/pkg/register"
)
// GraphCommand is the entrypoint for the graph command.
2020-02-10 17:04:40 +01:00
func GraphCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "graph",
Usage: "Start graph server",
Category: "Extensions",
2019-12-17 14:37:23 +01:00
Flags: flagset.ServerWithConfig(cfg.Graph),
2020-03-17 15:01:09 +01:00
Action: func(ctx *cli.Context) error {
graphCommand := command.Server(configureGraph(cfg))
2020-03-17 15:01:09 +01:00
if err := graphCommand.Before(ctx); err != nil {
return err
}
return cli.HandleAction(graphCommand.Action, ctx)
},
}
}
func configureGraph(cfg *config.Config) *svcconfig.Config {
cfg.Graph.Log.Level = cfg.Log.Level
cfg.Graph.Log.Pretty = cfg.Log.Pretty
cfg.Graph.Log.Color = cfg.Log.Color
return cfg.Graph
}
func init() {
register.AddCommand(GraphCommand)
}