File tree Expand file tree Collapse file tree 3 files changed +46
-47
lines changed Expand file tree Collapse file tree 3 files changed +46
-47
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import (
3333 "go-micro.dev/v5/store"
3434 "go-micro.dev/v5/store/mysql"
3535 "go-micro.dev/v5/transport"
36- profileconfig "go-micro.dev/v5/profileconfig "
36+ mprofile "go-micro.dev/v5/profile "
3737)
3838
3939type Cmd interface {
@@ -448,13 +448,13 @@ func (c *cmd) Before(ctx *cli.Context) error {
448448 if profileName != "" {
449449 switch profileName {
450450 case "local" :
451- imported := profileconfig .LocalProfile ()
451+ imported := mprofile .LocalProfile ()
452452 * c .opts .Registry = imported .Registry
453453 * c .opts .Broker = imported .Broker
454454 * c .opts .Store = imported .Store
455455 * c .opts .Transport = imported .Transport
456456 case "nats" :
457- imported := profileconfig .NatsProfile ()
457+ imported := mprofile .NatsProfile ()
458458 * c .opts .Registry = imported .Registry
459459 * c .opts .Broker = imported .Broker
460460 * c .opts .Store = imported .Store
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ // Package profileconfig provides grouped plugin profiles for go-micro
2+ package profile
3+
4+ import (
5+ "os"
6+ "go-micro.dev/v5/broker"
7+ "go-micro.dev/v5/broker/http"
8+ "go-micro.dev/v5/broker/nats"
9+ "go-micro.dev/v5/registry"
10+ nreg "go-micro.dev/v5/registry/nats"
11+ "go-micro.dev/v5/store"
12+
13+ "go-micro.dev/v5/transport"
14+
15+ )
16+
17+ type Profile struct {
18+ Registry registry.Registry
19+ Broker broker.Broker
20+ Store store.Store
21+ Transport transport.Transport
22+ }
23+
24+ func LocalProfile () Profile {
25+ return Profile {
26+ Registry : registry .NewMDNSRegistry (),
27+ Broker : http .NewHttpBroker (),
28+ Store : store .NewFileStore (),
29+ Transport : transport .NewHTTPTransport (),
30+ }
31+ }
32+
33+ func NatsProfile () Profile {
34+ addr := os .Getenv ("MICRO_NATS_ADDRESS" )
35+ return Profile {
36+ Registry : nreg .NewNatsRegistry (registry .Addrs (addr )),
37+ Broker : nats .NewNatsBroker (broker .Addrs (addr )),
38+ Store : store .NewFileStore (), // or nats-backed store if available
39+ Transport : transport .NewHTTPTransport (), // or nats transport if available
40+ }
41+ }
42+
43+ // Add more profiles as needed, e.g. grpc
You can’t perform that action at this time.
0 commit comments