From c76f1413d3288e1d368269a6b119ecebf15da971 Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Tue, 17 Mar 2020 14:58:58 +0100 Subject: [PATCH] update runtime package: command calling more intuitive --- pkg/micro/runtime/runtime.go | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/pkg/micro/runtime/runtime.go b/pkg/micro/runtime/runtime.go index 9c5d4e91a3..f23b2b5c91 100644 --- a/pkg/micro/runtime/runtime.go +++ b/pkg/micro/runtime/runtime.go @@ -21,16 +21,16 @@ var ( // MicroServices to start as part of the fullstack option MicroServices = []string{ - "api", // :8080 - "proxy", // :8081 + "api", // :8080 + // "proxy", // :8081 "web", // :8082 "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 = []string{ - "hello", + // "hello", "phoenix", "graph", "graph-explorer", @@ -49,7 +49,7 @@ var ( "reva-storage-oc-data", "devldap", "konnectd", - "proxy", + "proxy", // TODO rename this command. It collides with micro's `proxy` } ) @@ -57,6 +57,7 @@ var ( type Runtime struct { Logger log.Logger R *gorun.Runtime + Ctx *cli.Context services []*gorun.Service } @@ -68,6 +69,7 @@ func New(opts ...Option) Runtime { r := Runtime{ Logger: options.Logger, R: options.MicroRuntime, + Ctx: options.Context, } for _, v := range append(MicroServices, Extensions...) { @@ -109,14 +111,18 @@ func (r Runtime) Trap() { func (r *Runtime) Start() { env := os.Environ() - for i := range r.services { - args := []gorun.CreateOption{ - gorun.WithCommand(os.Args[0], r.services[i].Name), + for _, s := range r.services { + args := []string{os.Args[0]} + + args = append(args, s.Name) + gorunArgs := []gorun.CreateOption{ + gorun.WithCommand(args...), gorun.WithEnv(env), gorun.WithOutput(os.Stdout), } - go (*r.R).Create(r.services[i], args...) + go (*r.R).Create(s, gorunArgs...) + args = args[:len(args)-1] } }