From 813ae5eb63af630eee478d7e0b2fc5b48dedb4aa Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 10 Jan 2020 11:59:19 +0100 Subject: [PATCH] simplify runtime builder --- pkg/command/server_simple.go | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/pkg/command/server_simple.go b/pkg/command/server_simple.go index 5db7ff5705..bad48eecc5 100644 --- a/pkg/command/server_simple.go +++ b/pkg/command/server_simple.go @@ -14,7 +14,11 @@ import ( "github.com/owncloud/ocis/pkg/tracing" ) -// Simple is the entrypoint for the server command. +var ( + SimpleRuntimeServices = []string{"hello", "konnectd", "phoenix"} +) + +// Simple is the entrypoint for the server command. It is the `ocis server` subcommand overloaded with a different set of services func Simple(cfg *config.Config) cli.Command { return cli.Command{ Name: "server", @@ -36,25 +40,15 @@ func Simple(cfg *config.Config) cli.Command { } runtime := runtime.New( - runtime.Services( - append( - runtime.RuntimeServices, - []string{ - "hello", - "konnectd", - "phoenix", - }..., - ), - ), runtime.Logger(logger), + runtime.Services(append(runtime.RuntimeServices, SimpleRuntimeServices...)), runtime.MicroRuntime(cmd.DefaultCmd.Options().Runtime), ) - // fork uses the micro runtime to fork go-micro services - runtime.Start() - - // trap blocks until a kill signal is sent - runtime.Trap() + { + runtime.Start() + runtime.Trap() + } return nil },