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 (
33
33
"go-micro.dev/v5/store"
34
34
"go-micro.dev/v5/store/mysql"
35
35
"go-micro.dev/v5/transport"
36
- profileconfig "go-micro.dev/v5/profileconfig "
36
+ mprofile "go-micro.dev/v5/profile "
37
37
)
38
38
39
39
type Cmd interface {
@@ -448,13 +448,13 @@ func (c *cmd) Before(ctx *cli.Context) error {
448
448
if profileName != "" {
449
449
switch profileName {
450
450
case "local" :
451
- imported := profileconfig .LocalProfile ()
451
+ imported := mprofile .LocalProfile ()
452
452
* c .opts .Registry = imported .Registry
453
453
* c .opts .Broker = imported .Broker
454
454
* c .opts .Store = imported .Store
455
455
* c .opts .Transport = imported .Transport
456
456
case "nats" :
457
- imported := profileconfig .NatsProfile ()
457
+ imported := mprofile .NatsProfile ()
458
458
* c .opts .Registry = imported .Registry
459
459
* c .opts .Broker = imported .Broker
460
460
* 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