mirror of
https://github.com/go-micro/go-micro.git
synced 2025-01-05 10:20:53 +02:00
strip runtime
This commit is contained in:
parent
29d79d748d
commit
3676232df1
@ -14,7 +14,6 @@ import (
|
|||||||
"go-micro.dev/v5/debug/trace"
|
"go-micro.dev/v5/debug/trace"
|
||||||
"go-micro.dev/v5/logger"
|
"go-micro.dev/v5/logger"
|
||||||
"go-micro.dev/v5/registry"
|
"go-micro.dev/v5/registry"
|
||||||
"go-micro.dev/v5/runtime"
|
|
||||||
"go-micro.dev/v5/selector"
|
"go-micro.dev/v5/selector"
|
||||||
"go-micro.dev/v5/server"
|
"go-micro.dev/v5/server"
|
||||||
"go-micro.dev/v5/store"
|
"go-micro.dev/v5/store"
|
||||||
|
@ -19,7 +19,6 @@ import (
|
|||||||
"go-micro.dev/v5/debug/trace"
|
"go-micro.dev/v5/debug/trace"
|
||||||
"go-micro.dev/v5/logger"
|
"go-micro.dev/v5/logger"
|
||||||
"go-micro.dev/v5/registry"
|
"go-micro.dev/v5/registry"
|
||||||
"go-micro.dev/v5/runtime"
|
|
||||||
"go-micro.dev/v5/selector"
|
"go-micro.dev/v5/selector"
|
||||||
"go-micro.dev/v5/server"
|
"go-micro.dev/v5/server"
|
||||||
"go-micro.dev/v5/store"
|
"go-micro.dev/v5/store"
|
||||||
@ -146,17 +145,6 @@ var (
|
|||||||
EnvVars: []string{"MICRO_REGISTRY_ADDRESS"},
|
EnvVars: []string{"MICRO_REGISTRY_ADDRESS"},
|
||||||
Usage: "Comma-separated list of registry addresses",
|
Usage: "Comma-separated list of registry addresses",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "runtime",
|
|
||||||
Usage: "Runtime for building and running services e.g local, kubernetes",
|
|
||||||
EnvVars: []string{"MICRO_RUNTIME"},
|
|
||||||
},
|
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "runtime_source",
|
|
||||||
Usage: "Runtime source for building and running services e.g github.com/micro/service",
|
|
||||||
EnvVars: []string{"MICRO_RUNTIME_SOURCE"},
|
|
||||||
Value: "github.com/micro/services",
|
|
||||||
},
|
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "selector",
|
Name: "selector",
|
||||||
EnvVars: []string{"MICRO_SELECTOR"},
|
EnvVars: []string{"MICRO_SELECTOR"},
|
||||||
@ -252,8 +240,6 @@ var (
|
|||||||
|
|
||||||
DefaultTransports = map[string]func(...transport.Option) transport.Transport{}
|
DefaultTransports = map[string]func(...transport.Option) transport.Transport{}
|
||||||
|
|
||||||
DefaultRuntimes = map[string]func(...runtime.Option) runtime.Runtime{}
|
|
||||||
|
|
||||||
DefaultStores = map[string]func(...store.Option) store.Store{}
|
DefaultStores = map[string]func(...store.Option) store.Store{}
|
||||||
|
|
||||||
DefaultTracers = map[string]func(...trace.Option) trace.Tracer{}
|
DefaultTracers = map[string]func(...trace.Option) trace.Tracer{}
|
||||||
@ -283,7 +269,6 @@ func newCmd(opts ...Option) Cmd {
|
|||||||
Server: &server.DefaultServer,
|
Server: &server.DefaultServer,
|
||||||
Selector: &selector.DefaultSelector,
|
Selector: &selector.DefaultSelector,
|
||||||
Transport: &transport.DefaultTransport,
|
Transport: &transport.DefaultTransport,
|
||||||
Runtime: &runtime.DefaultRuntime,
|
|
||||||
Store: &store.DefaultStore,
|
Store: &store.DefaultStore,
|
||||||
Tracer: &trace.DefaultTracer,
|
Tracer: &trace.DefaultTracer,
|
||||||
Profile: &profile.DefaultProfile,
|
Profile: &profile.DefaultProfile,
|
||||||
@ -371,16 +356,6 @@ func (c *cmd) Before(ctx *cli.Context) error {
|
|||||||
*c.opts.Store = s(store.WithClient(*c.opts.Client))
|
*c.opts.Store = s(store.WithClient(*c.opts.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the runtime
|
|
||||||
if name := ctx.String("runtime"); len(name) > 0 {
|
|
||||||
r, ok := c.opts.Runtimes[name]
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("Unsupported runtime: %s", name)
|
|
||||||
}
|
|
||||||
|
|
||||||
*c.opts.Runtime = r(runtime.WithClient(*c.opts.Client))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the tracer
|
// Set the tracer
|
||||||
if name := ctx.String("tracer"); len(name) > 0 {
|
if name := ctx.String("tracer"); len(name) > 0 {
|
||||||
r, ok := c.opts.Tracers[name]
|
r, ok := c.opts.Tracers[name]
|
||||||
@ -566,12 +541,6 @@ func (c *cmd) Before(ctx *cli.Context) error {
|
|||||||
serverOpts = append(serverOpts, server.RegisterInterval(val*time.Second))
|
serverOpts = append(serverOpts, server.RegisterInterval(val*time.Second))
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(ctx.String("runtime_source")) > 0 {
|
|
||||||
if err := (*c.opts.Runtime).Init(runtime.WithSource(ctx.String("runtime_source"))); err != nil {
|
|
||||||
logger.Fatalf("Error configuring runtime: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// client opts
|
// client opts
|
||||||
if r := ctx.Int("client_retries"); r >= 0 {
|
if r := ctx.Int("client_retries"); r >= 0 {
|
||||||
clientOpts = append(clientOpts, client.Retries(r))
|
clientOpts = append(clientOpts, client.Retries(r))
|
||||||
|
@ -11,7 +11,6 @@ import (
|
|||||||
"go-micro.dev/v5/debug/profile"
|
"go-micro.dev/v5/debug/profile"
|
||||||
"go-micro.dev/v5/debug/trace"
|
"go-micro.dev/v5/debug/trace"
|
||||||
"go-micro.dev/v5/registry"
|
"go-micro.dev/v5/registry"
|
||||||
"go-micro.dev/v5/runtime"
|
|
||||||
"go-micro.dev/v5/selector"
|
"go-micro.dev/v5/selector"
|
||||||
"go-micro.dev/v5/server"
|
"go-micro.dev/v5/server"
|
||||||
"go-micro.dev/v5/store"
|
"go-micro.dev/v5/store"
|
||||||
|
Loading…
Reference in New Issue
Block a user