Merge pull request #148 from owncloud/feature/propagate-config-file
Make extensions handle their config
This commit is contained in:
+15
-1
@@ -78,7 +78,21 @@ To the list of available services.
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
We provide overall three different variants of configuration. The variant based on environment variables and commandline flags are split up into global values and command-specific values.
|
oCIS Single Binary is not responsible for configuring extensions. Instead, each extension could either be configured by environment variables, cli flags or config files.
|
||||||
|
|
||||||
|
### Configuration using config files
|
||||||
|
|
||||||
|
Out of the box extensions will attempt to read configuration details from:
|
||||||
|
|
||||||
|
```console
|
||||||
|
/etc/ocis
|
||||||
|
$HOME/.ocis
|
||||||
|
./config
|
||||||
|
```
|
||||||
|
|
||||||
|
For this configuration to be picked up, have a look at your extension `root` command and look for which default config name it has assigned. *i.e: ocis-proxy reads `ocis.json | yaml | toml ...`*.
|
||||||
|
|
||||||
|
> Important note: As per the time of this writing, Viper does not play nice with urfave/cli flags, this results in values defined on config files taking precedence over cli flags. This behavior is different with environment variables, these will ALWAYS override any value, as they are the most explicit.
|
||||||
|
|
||||||
### Envrionment variables
|
### Envrionment variables
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ require (
|
|||||||
github.com/micro/go-micro/v2 v2.0.1-0.20200212105717-d76baf59de2e
|
github.com/micro/go-micro/v2 v2.0.1-0.20200212105717-d76baf59de2e
|
||||||
github.com/micro/micro/v2 v2.0.1-0.20200210100719-f38a1d8d5348
|
github.com/micro/micro/v2 v2.0.1-0.20200210100719-f38a1d8d5348
|
||||||
github.com/openzipkin/zipkin-go v0.2.2
|
github.com/openzipkin/zipkin-go v0.2.2
|
||||||
|
github.com/owncloud/ocis-devldap v0.0.0-20200311185721-105f9cbe4ce4 // indirect
|
||||||
github.com/owncloud/ocis-glauth v0.2.0
|
github.com/owncloud/ocis-glauth v0.2.0
|
||||||
github.com/owncloud/ocis-graph v0.0.0-20200217115956-172417259283
|
github.com/owncloud/ocis-graph v0.0.0-20200217115956-172417259283
|
||||||
github.com/owncloud/ocis-graph-explorer v0.0.0-20200210111049-017eeb40dc0c
|
github.com/owncloud/ocis-graph-explorer v0.0.0-20200210111049-017eeb40dc0c
|
||||||
@@ -19,13 +20,12 @@ require (
|
|||||||
github.com/owncloud/ocis-konnectd v0.0.0-20200303180152-937016f63393
|
github.com/owncloud/ocis-konnectd v0.0.0-20200303180152-937016f63393
|
||||||
github.com/owncloud/ocis-ocs v0.0.0-20200207130609-800a64d45fac
|
github.com/owncloud/ocis-ocs v0.0.0-20200207130609-800a64d45fac
|
||||||
github.com/owncloud/ocis-phoenix v0.1.1-0.20200213204418-06f50c42c225
|
github.com/owncloud/ocis-phoenix v0.1.1-0.20200213204418-06f50c42c225
|
||||||
github.com/owncloud/ocis-pkg/v2 v2.0.2
|
github.com/owncloud/ocis-pkg/v2 v2.0.3-0.20200309150924-5c659fd4b0ad
|
||||||
github.com/owncloud/ocis-proxy v0.0.0-20200310100127-5a38d286e52c
|
github.com/owncloud/ocis-proxy v0.0.0-20200310100127-5a38d286e52c
|
||||||
github.com/owncloud/ocis-reva v0.0.0-20200213202552-584d47daa8bc
|
github.com/owncloud/ocis-reva v0.0.0-20200213202552-584d47daa8bc
|
||||||
github.com/owncloud/ocis-webdav v0.0.0-20200210113150-6c4d498c38b0
|
github.com/owncloud/ocis-webdav v0.0.0-20200210113150-6c4d498c38b0
|
||||||
github.com/spf13/viper v1.6.2
|
go.opencensus.io v0.22.2
|
||||||
go.opencensus.io v0.22.3
|
golang.org/x/crypto v0.0.0-20200311171314-f7b00557c8c4 // indirect
|
||||||
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d // indirect
|
|
||||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b // indirect
|
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b // indirect
|
||||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae // indirect
|
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae // indirect
|
||||||
stash.kopano.io/kc/konnect v0.29.0 // indirect
|
stash.kopano.io/kc/konnect v0.29.0 // indirect
|
||||||
|
|||||||
@@ -18,13 +18,14 @@ func GraphExplorerCommand(cfg *config.Config) *cli.Command {
|
|||||||
Usage: "Start graph explorer",
|
Usage: "Start graph explorer",
|
||||||
Category: "Extensions",
|
Category: "Extensions",
|
||||||
Flags: flagset.ServerWithConfig(cfg.GraphExplorer),
|
Flags: flagset.ServerWithConfig(cfg.GraphExplorer),
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(ctx *cli.Context) error {
|
||||||
scfg := configureGraphExplorer(cfg)
|
graphExplorerCommand := command.Server(configureGraphExplorer(cfg))
|
||||||
|
|
||||||
return cli.HandleAction(
|
if err := graphExplorerCommand.Before(ctx); err != nil {
|
||||||
command.Server(scfg).Action,
|
return err
|
||||||
c,
|
}
|
||||||
)
|
|
||||||
|
return cli.HandleAction(graphExplorerCommand.Action, ctx)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,9 +34,6 @@ func configureGraphExplorer(cfg *config.Config) *svcconfig.Config {
|
|||||||
cfg.GraphExplorer.Log.Level = cfg.Log.Level
|
cfg.GraphExplorer.Log.Level = cfg.Log.Level
|
||||||
cfg.GraphExplorer.Log.Pretty = cfg.Log.Pretty
|
cfg.GraphExplorer.Log.Pretty = cfg.Log.Pretty
|
||||||
cfg.GraphExplorer.Log.Color = cfg.Log.Color
|
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
|
return cfg.GraphExplorer
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,13 +18,14 @@ func GraphCommand(cfg *config.Config) *cli.Command {
|
|||||||
Usage: "Start graph server",
|
Usage: "Start graph server",
|
||||||
Category: "Extensions",
|
Category: "Extensions",
|
||||||
Flags: flagset.ServerWithConfig(cfg.Graph),
|
Flags: flagset.ServerWithConfig(cfg.Graph),
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(ctx *cli.Context) error {
|
||||||
scfg := configureGraph(cfg)
|
graphCommand := command.Server(configureGraph(cfg))
|
||||||
|
|
||||||
return cli.HandleAction(
|
if err := graphCommand.Before(ctx); err != nil {
|
||||||
command.Server(scfg).Action,
|
return err
|
||||||
c,
|
}
|
||||||
)
|
|
||||||
|
return cli.HandleAction(graphCommand.Action, ctx)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,9 +34,6 @@ func configureGraph(cfg *config.Config) *svcconfig.Config {
|
|||||||
cfg.Graph.Log.Level = cfg.Log.Level
|
cfg.Graph.Log.Level = cfg.Log.Level
|
||||||
cfg.Graph.Log.Pretty = cfg.Log.Pretty
|
cfg.Graph.Log.Pretty = cfg.Log.Pretty
|
||||||
cfg.Graph.Log.Color = cfg.Log.Color
|
cfg.Graph.Log.Color = cfg.Log.Color
|
||||||
cfg.Graph.Tracing.Enabled = false
|
|
||||||
cfg.Graph.HTTP.Addr = "localhost:9120"
|
|
||||||
cfg.Graph.HTTP.Root = "/"
|
|
||||||
|
|
||||||
return cfg.Graph
|
return cfg.Graph
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
package command
|
package command
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -18,14 +17,13 @@ func KonnectdCommand(cfg *config.Config) *cli.Command {
|
|||||||
Category: "Extensions",
|
Category: "Extensions",
|
||||||
Flags: flagset.ServerWithConfig(cfg.Konnectd),
|
Flags: flagset.ServerWithConfig(cfg.Konnectd),
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
serverConfig := configureKonnectd(cfg)
|
konnectdCommand := command.Server(configureKonnectd(cfg))
|
||||||
serverCommand := command.Server(serverConfig)
|
|
||||||
|
|
||||||
if err := serverCommand.Before(c); err != nil {
|
if err := konnectdCommand.Before(c); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return cli.HandleAction(serverCommand.Action, c)
|
return cli.HandleAction(konnectdCommand.Action, c)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,9 +32,6 @@ func configureKonnectd(cfg *config.Config) *svcconfig.Config {
|
|||||||
cfg.Konnectd.Log.Level = cfg.Log.Level
|
cfg.Konnectd.Log.Level = cfg.Log.Level
|
||||||
cfg.Konnectd.Log.Pretty = cfg.Log.Pretty
|
cfg.Konnectd.Log.Pretty = cfg.Log.Pretty
|
||||||
cfg.Konnectd.Log.Color = cfg.Log.Color
|
cfg.Konnectd.Log.Color = cfg.Log.Color
|
||||||
cfg.Konnectd.Tracing.Enabled = false
|
|
||||||
cfg.Konnectd.HTTP.Addr = "localhost:9130"
|
|
||||||
cfg.Konnectd.HTTP.Root = "/"
|
|
||||||
|
|
||||||
return cfg.Konnectd
|
return cfg.Konnectd
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-9
@@ -18,13 +18,14 @@ func OCSCommand(cfg *config.Config) *cli.Command {
|
|||||||
Usage: "Start ocs server",
|
Usage: "Start ocs server",
|
||||||
Category: "Extensions",
|
Category: "Extensions",
|
||||||
Flags: flagset.ServerWithConfig(cfg.OCS),
|
Flags: flagset.ServerWithConfig(cfg.OCS),
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(ctx *cli.Context) error {
|
||||||
scfg := configureOCS(cfg)
|
ocsCommand := command.Server(configureOCS(cfg))
|
||||||
|
|
||||||
return cli.HandleAction(
|
if err := ocsCommand.Before(ctx); err != nil {
|
||||||
command.Server(scfg).Action,
|
return err
|
||||||
c,
|
}
|
||||||
)
|
|
||||||
|
return cli.HandleAction(ocsCommand.Action, ctx)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,9 +34,6 @@ func configureOCS(cfg *config.Config) *svcconfig.Config {
|
|||||||
cfg.OCS.Log.Level = cfg.Log.Level
|
cfg.OCS.Log.Level = cfg.Log.Level
|
||||||
cfg.OCS.Log.Pretty = cfg.Log.Pretty
|
cfg.OCS.Log.Pretty = cfg.Log.Pretty
|
||||||
cfg.OCS.Log.Color = cfg.Log.Color
|
cfg.OCS.Log.Color = cfg.Log.Color
|
||||||
cfg.OCS.Tracing.Enabled = false
|
|
||||||
cfg.OCS.HTTP.Addr = "localhost:9110"
|
|
||||||
cfg.OCS.HTTP.Root = "/"
|
|
||||||
|
|
||||||
return cfg.OCS
|
return cfg.OCS
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,17 +23,16 @@ func PhoenixCommand(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cfg.Phoenix.Phoenix.Config.Apps = c.StringSlice("web-config-app")
|
cfg.Phoenix.Phoenix.Config.Apps = c.StringSlice("web-config-app")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
|
phoenixCommand := command.Server(configurePhoenix(cfg))
|
||||||
|
|
||||||
scfg := configurePhoenix(cfg)
|
if err := phoenixCommand.Before(c); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return cli.HandleAction(
|
return cli.HandleAction(phoenixCommand.Action, c)
|
||||||
command.Server(scfg).Action,
|
|
||||||
c,
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,15 +16,14 @@ func ProxyCommand(cfg *config.Config) *cli.Command {
|
|||||||
Usage: "Start proxy server",
|
Usage: "Start proxy server",
|
||||||
Category: "Extensions",
|
Category: "Extensions",
|
||||||
Flags: flagset.ServerWithConfig(cfg.Proxy),
|
Flags: flagset.ServerWithConfig(cfg.Proxy),
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(ctx *cli.Context) error {
|
||||||
serverConfig := configureProxy(cfg)
|
proxyCommand := command.Server(configureProxy(cfg))
|
||||||
serverCommand := command.Server(serverConfig)
|
|
||||||
|
|
||||||
if err := serverCommand.Before(c); err != nil {
|
if err := proxyCommand.Before(ctx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return cli.HandleAction(serverCommand.Action, c)
|
return cli.HandleAction(proxyCommand.Action, ctx)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package command
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/micro/cli/v2"
|
"github.com/micro/cli/v2"
|
||||||
"github.com/owncloud/ocis-pkg/v2/log"
|
"github.com/owncloud/ocis-pkg/v2/log"
|
||||||
@@ -11,7 +10,6 @@ import (
|
|||||||
"github.com/owncloud/ocis/pkg/micro/runtime"
|
"github.com/owncloud/ocis/pkg/micro/runtime"
|
||||||
"github.com/owncloud/ocis/pkg/register"
|
"github.com/owncloud/ocis/pkg/register"
|
||||||
"github.com/owncloud/ocis/pkg/version"
|
"github.com/owncloud/ocis/pkg/version"
|
||||||
"github.com/spf13/viper"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Execute is the entry point for the ocis-ocis command.
|
// Execute is the entry point for the ocis-ocis command.
|
||||||
@@ -30,53 +28,9 @@ func Execute() error {
|
|||||||
Email: "support@owncloud.com",
|
Email: "support@owncloud.com",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
Flags: flagset.RootWithConfig(cfg),
|
Flags: flagset.RootWithConfig(cfg),
|
||||||
|
|
||||||
Before: func(c *cli.Context) error {
|
|
||||||
logger := NewLogger(cfg)
|
|
||||||
|
|
||||||
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
|
||||||
viper.SetEnvPrefix("OCIS")
|
|
||||||
viper.AutomaticEnv()
|
|
||||||
|
|
||||||
if c.IsSet("config-file") {
|
|
||||||
viper.SetConfigFile(c.String("config-file"))
|
|
||||||
} else {
|
|
||||||
viper.SetConfigName("ocis")
|
|
||||||
|
|
||||||
viper.AddConfigPath("/etc/ocis")
|
|
||||||
viper.AddConfigPath("$HOME/.ocis")
|
|
||||||
viper.AddConfigPath("./config")
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := viper.ReadInConfig(); err != nil {
|
|
||||||
switch err.(type) {
|
|
||||||
case viper.ConfigFileNotFoundError:
|
|
||||||
logger.Info().
|
|
||||||
Msg("Continue without config")
|
|
||||||
case viper.UnsupportedConfigError:
|
|
||||||
logger.Fatal().
|
|
||||||
Err(err).
|
|
||||||
Msg("Unsupported config type")
|
|
||||||
default:
|
|
||||||
logger.Fatal().
|
|
||||||
Err(err).
|
|
||||||
Msg("Failed to read config")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := viper.Unmarshal(&cfg); err != nil {
|
|
||||||
logger.Fatal().
|
|
||||||
Err(err).
|
|
||||||
Msg("Failed to parse config")
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load commands from the registry
|
|
||||||
for _, fn := range register.Commands {
|
for _, fn := range register.Commands {
|
||||||
app.Commands = append(
|
app.Commands = append(
|
||||||
app.Commands,
|
app.Commands,
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
runtime.Services(append(runtime.MicroServices, runtime.Extensions...)),
|
runtime.Services(append(runtime.MicroServices, runtime.Extensions...)),
|
||||||
runtime.Logger(logger),
|
runtime.Logger(logger),
|
||||||
runtime.MicroRuntime(cmd.DefaultCmd.Options().Runtime),
|
runtime.MicroRuntime(cmd.DefaultCmd.Options().Runtime),
|
||||||
|
runtime.Context(c),
|
||||||
)
|
)
|
||||||
|
|
||||||
runtime.Start()
|
runtime.Start()
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ func Simple(cfg *config.Config) *cli.Command {
|
|||||||
runtime.Logger(logger),
|
runtime.Logger(logger),
|
||||||
runtime.Services(append(runtime.RuntimeServices, SimpleRuntimeServices...)),
|
runtime.Services(append(runtime.RuntimeServices, SimpleRuntimeServices...)),
|
||||||
runtime.MicroRuntime(cmd.DefaultCmd.Options().Runtime),
|
runtime.MicroRuntime(cmd.DefaultCmd.Options().Runtime),
|
||||||
|
runtime.Context(c),
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,12 +19,13 @@ func WebDAVCommand(cfg *config.Config) *cli.Command {
|
|||||||
Category: "Extensions",
|
Category: "Extensions",
|
||||||
Flags: flagset.ServerWithConfig(cfg.WebDAV),
|
Flags: flagset.ServerWithConfig(cfg.WebDAV),
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
scfg := configureWebDAV(cfg)
|
webdavCommand := command.Server(configureWebDAV(cfg))
|
||||||
|
|
||||||
return cli.HandleAction(
|
if err := webdavCommand.Before(c); err != nil {
|
||||||
command.Server(scfg).Action,
|
return err
|
||||||
c,
|
}
|
||||||
)
|
|
||||||
|
return cli.HandleAction(webdavCommand.Action, c)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,9 +34,6 @@ func configureWebDAV(cfg *config.Config) *svcconfig.Config {
|
|||||||
cfg.WebDAV.Log.Level = cfg.Log.Level
|
cfg.WebDAV.Log.Level = cfg.Log.Level
|
||||||
cfg.WebDAV.Log.Pretty = cfg.Log.Pretty
|
cfg.WebDAV.Log.Pretty = cfg.Log.Pretty
|
||||||
cfg.WebDAV.Log.Color = cfg.Log.Color
|
cfg.WebDAV.Log.Color = cfg.Log.Color
|
||||||
cfg.WebDAV.Tracing.Enabled = false
|
|
||||||
cfg.WebDAV.HTTP.Addr = "localhost:9115"
|
|
||||||
cfg.WebDAV.HTTP.Root = "/"
|
|
||||||
|
|
||||||
return cfg.WebDAV
|
return cfg.WebDAV
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package runtime
|
package runtime
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/micro/cli/v2"
|
||||||
gorun "github.com/micro/go-micro/v2/runtime"
|
gorun "github.com/micro/go-micro/v2/runtime"
|
||||||
"github.com/owncloud/ocis-pkg/v2/log"
|
"github.com/owncloud/ocis-pkg/v2/log"
|
||||||
)
|
)
|
||||||
@@ -10,6 +11,7 @@ type Options struct {
|
|||||||
Services []string
|
Services []string
|
||||||
Logger log.Logger
|
Logger log.Logger
|
||||||
MicroRuntime *gorun.Runtime
|
MicroRuntime *gorun.Runtime
|
||||||
|
Context *cli.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
// Option undocummented
|
// Option undocummented
|
||||||
@@ -46,3 +48,10 @@ func MicroRuntime(rt *gorun.Runtime) Option {
|
|||||||
o.MicroRuntime = rt
|
o.MicroRuntime = rt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Context option
|
||||||
|
func Context(c *cli.Context) Option {
|
||||||
|
return func(o *Options) {
|
||||||
|
o.Context = c
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,16 +21,16 @@ var (
|
|||||||
|
|
||||||
// MicroServices to start as part of the fullstack option
|
// MicroServices to start as part of the fullstack option
|
||||||
MicroServices = []string{
|
MicroServices = []string{
|
||||||
"api", // :8080
|
"api", // :8080
|
||||||
"proxy", // :8081
|
// "proxy", // :8081
|
||||||
"web", // :8082
|
"web", // :8082
|
||||||
"registry", // :8000
|
"registry", // :8000
|
||||||
"runtime", // :8088 (future proof. We want to be able to control extensions through a runtime)
|
// "runtime", // :8088 (future proof. We want to be able to control extensions through a runtime)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extensions are ocis extension services
|
// Extensions are ocis extension services
|
||||||
Extensions = []string{
|
Extensions = []string{
|
||||||
"hello",
|
// "hello",
|
||||||
"phoenix",
|
"phoenix",
|
||||||
"graph",
|
"graph",
|
||||||
"graph-explorer",
|
"graph-explorer",
|
||||||
@@ -49,7 +49,7 @@ var (
|
|||||||
"reva-storage-oc-data",
|
"reva-storage-oc-data",
|
||||||
"glauth",
|
"glauth",
|
||||||
"konnectd",
|
"konnectd",
|
||||||
"proxy",
|
"proxy", // TODO rename this command. It collides with micro's `proxy`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -57,6 +57,7 @@ var (
|
|||||||
type Runtime struct {
|
type Runtime struct {
|
||||||
Logger log.Logger
|
Logger log.Logger
|
||||||
R *gorun.Runtime
|
R *gorun.Runtime
|
||||||
|
Ctx *cli.Context
|
||||||
|
|
||||||
services []*gorun.Service
|
services []*gorun.Service
|
||||||
}
|
}
|
||||||
@@ -68,6 +69,7 @@ func New(opts ...Option) Runtime {
|
|||||||
r := Runtime{
|
r := Runtime{
|
||||||
Logger: options.Logger,
|
Logger: options.Logger,
|
||||||
R: options.MicroRuntime,
|
R: options.MicroRuntime,
|
||||||
|
Ctx: options.Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range append(MicroServices, Extensions...) {
|
for _, v := range append(MicroServices, Extensions...) {
|
||||||
@@ -109,14 +111,18 @@ func (r Runtime) Trap() {
|
|||||||
func (r *Runtime) Start() {
|
func (r *Runtime) Start() {
|
||||||
env := os.Environ()
|
env := os.Environ()
|
||||||
|
|
||||||
for i := range r.services {
|
for _, s := range r.services {
|
||||||
args := []gorun.CreateOption{
|
args := []string{os.Args[0]}
|
||||||
gorun.WithCommand(os.Args[0], r.services[i].Name),
|
|
||||||
|
args = append(args, s.Name)
|
||||||
|
gorunArgs := []gorun.CreateOption{
|
||||||
|
gorun.WithCommand(args...),
|
||||||
gorun.WithEnv(env),
|
gorun.WithEnv(env),
|
||||||
gorun.WithOutput(os.Stdout),
|
gorun.WithOutput(os.Stdout),
|
||||||
}
|
}
|
||||||
|
|
||||||
go (*r.R).Create(r.services[i], args...)
|
go (*r.R).Create(s, gorunArgs...)
|
||||||
|
// args = args[:len(args)-1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user