diff --git a/go.mod b/go.mod index b1b2bff6f..b52536969 100644 --- a/go.mod +++ b/go.mod @@ -17,6 +17,7 @@ require ( github.com/onsi/ginkgo v1.10.3 // indirect github.com/openzipkin/zipkin-go v0.2.2 github.com/owncloud/ocis-graph v0.0.0-20191227120927-91e17d0cdeb1 + github.com/owncloud/ocis-graph-explorer v0.0.0-20200128104949-78e556279eab github.com/owncloud/ocis-hello v0.0.0-20200114093148-2205c2745838 github.com/owncloud/ocis-konnectd v0.0.0-20191227185917-046fec203337 github.com/owncloud/ocis-ocs v0.0.0-20191224113758-20455a2e9013 diff --git a/go.sum b/go.sum index ac064c56d..a27b1408d 100644 --- a/go.sum +++ b/go.sum @@ -621,6 +621,12 @@ github.com/ory/go-convenience v0.1.0/go.mod h1:uEY/a60PL5c12nYz4V5cHY03IBmwIAEm8 github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014/go.mod h1:joRatxRJaZBsY3JAOEMcoOp05CnZzsx4scTxi95DHyQ= github.com/owncloud/ocis-graph v0.0.0-20191227120927-91e17d0cdeb1 h1:Zamh3nQI2moI/rfbuNHwog0KXU9osNLVkUM2BfcHA0g= github.com/owncloud/ocis-graph v0.0.0-20191227120927-91e17d0cdeb1/go.mod h1:7fIggCksf10Nlu0KhU9U9KeY+v7n47OHLjWMRrNxlg8= +github.com/owncloud/ocis-graph-explorer v0.0.0-20200123111637-3b2e1da63f17 h1:avZsUazewQurfNZTf091PeYw7v8GvfpFO5pbA0MDo3I= +github.com/owncloud/ocis-graph-explorer v0.0.0-20200123111637-3b2e1da63f17/go.mod h1:MtgUsjJfUpeDvxDCmMhUjqnzrjg8qjjP4HhlLKufDdc= +github.com/owncloud/ocis-graph-explorer v0.0.0-20200128090021-bf345cff039a h1:h3T35ffMZ0BTfENw3ErNei8sCRy6D6fTdeGqQKNTpsU= +github.com/owncloud/ocis-graph-explorer v0.0.0-20200128090021-bf345cff039a/go.mod h1:MtgUsjJfUpeDvxDCmMhUjqnzrjg8qjjP4HhlLKufDdc= +github.com/owncloud/ocis-graph-explorer v0.0.0-20200128104949-78e556279eab h1:yvWqFZNPKQbtuSzzlS5+F9qBX2R8YX0EH7swdQeUvm0= +github.com/owncloud/ocis-graph-explorer v0.0.0-20200128104949-78e556279eab/go.mod h1:MtgUsjJfUpeDvxDCmMhUjqnzrjg8qjjP4HhlLKufDdc= github.com/owncloud/ocis-hello v0.0.0-20200114093148-2205c2745838 h1:kG/H/Ey6sqU6xIzsDtZEpR321NlyPrsxPKrDAe9sbY0= github.com/owncloud/ocis-hello v0.0.0-20200114093148-2205c2745838/go.mod h1:hrXqmloO2NHbdkDTPSNneobwzQgki8CUuQD8fqjkPv8= github.com/owncloud/ocis-konnectd v0.0.0-20191227185917-046fec203337 h1:ZGqMcrWZgGoH+jztjSFvzAJGw3lsG2/jjZQioV4ZcDY= diff --git a/pkg/command/graph-explorer.go b/pkg/command/graph-explorer.go new file mode 100644 index 000000000..8ca0508de --- /dev/null +++ b/pkg/command/graph-explorer.go @@ -0,0 +1,45 @@ +// +build !simple + +package command + +import ( + "github.com/micro/cli" + "github.com/owncloud/ocis-graph-explorer/pkg/command" + svcconfig "github.com/owncloud/ocis-graph-explorer/pkg/config" + "github.com/owncloud/ocis-graph-explorer/pkg/flagset" + "github.com/owncloud/ocis/pkg/config" + "github.com/owncloud/ocis/pkg/register" +) + +// GraphExplorerCommand is the entry point for the graph command. +func GraphExplorerCommand(cfg *config.Config) cli.Command { + return cli.Command{ + Name: "graph-explorer", + Usage: "Start graph explorer", + Category: "Extensions", + Flags: flagset.ServerWithConfig(cfg.GraphExplorer), + Action: func(c *cli.Context) error { + scfg := configureGraphExplorer(cfg) + + return cli.HandleAction( + command.Server(scfg).Action, + c, + ) + }, + } +} + +func configureGraphExplorer(cfg *config.Config) *svcconfig.Config { + cfg.GraphExplorer.Log.Level = cfg.Log.Level + cfg.GraphExplorer.Log.Pretty = cfg.Log.Pretty + cfg.GraphExplorer.Log.Color = cfg.Log.Color + cfg.GraphExplorer.Tracing.Enabled = false + cfg.GraphExplorer.HTTP.Addr = "localhost:9135" + cfg.GraphExplorer.HTTP.Root = "/" + + return cfg.GraphExplorer +} + +func init() { + register.AddCommand(GraphExplorerCommand) +} diff --git a/pkg/config/config.go b/pkg/config/config.go index df899bc30..e89baa985 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -2,6 +2,7 @@ package config import ( graph "github.com/owncloud/ocis-graph/pkg/config" + graphExplorer "github.com/owncloud/ocis-graph-explorer/pkg/config" hello "github.com/owncloud/ocis-hello/pkg/config" konnectd "github.com/owncloud/ocis-konnectd/pkg/config" ocs "github.com/owncloud/ocis-ocs/pkg/config" @@ -54,24 +55,26 @@ type Config struct { GRPC GRPC Tracing Tracing - Graph *graph.Config - Hello *hello.Config - Konnectd *konnectd.Config - OCS *ocs.Config - Phoenix *phoenix.Config - WebDAV *webdav.Config - Reva *reva.Config + Graph *graph.Config + GraphExplorer *graphExplorer.Config + Hello *hello.Config + Konnectd *konnectd.Config + OCS *ocs.Config + Phoenix *phoenix.Config + WebDAV *webdav.Config + Reva *reva.Config } // New initializes a new configuration with or without defaults. func New() *Config { return &Config{ - Graph: graph.New(), - Hello: hello.New(), - Konnectd: konnectd.New(), - OCS: ocs.New(), - Phoenix: phoenix.New(), - WebDAV: webdav.New(), - Reva: reva.New(), + Graph: graph.New(), + GraphExplorer: graphExplorer.New(), + Hello: hello.New(), + Konnectd: konnectd.New(), + OCS: ocs.New(), + Phoenix: phoenix.New(), + WebDAV: webdav.New(), + Reva: reva.New(), } } diff --git a/pkg/micro/runtime/runtime.go b/pkg/micro/runtime/runtime.go index 4d01b6f12..64f781f32 100644 --- a/pkg/micro/runtime/runtime.go +++ b/pkg/micro/runtime/runtime.go @@ -41,6 +41,7 @@ var Extensions = []string{ "hello", "phoenix", "graph", + "graph-explorer", "ocs", "webdav", "reva-frontend",