discovery: +invoke url

This commit is contained in:
Stephan D
2026-01-19 11:07:21 +01:00
parent 1eb5a918a0
commit 64803a21e0
26 changed files with 170 additions and 32 deletions

View File

@@ -4,6 +4,7 @@ runtime:
grpc:
network: tcp
address: ":50070"
advertise_host: "sendico_chain_gateway"
enable_reflection: true
enable_health: true

View File

@@ -148,7 +148,12 @@ func (i *Imp) Start() error {
}
serviceFactory := func(logger mlogger.Logger, repo storage.Repository, producer msg.Producer) (grpcapp.Service, error) {
invokeURI := ""
if cfg.GRPC != nil {
invokeURI = cfg.GRPC.DiscoveryInvokeURI()
}
opts := []gatewayservice.Option{
gatewayservice.WithDiscoveryInvokeURI(invokeURI),
gatewayservice.WithNetworks(networkConfigs),
gatewayservice.WithServiceWallet(walletConfig),
gatewayservice.WithKeyManager(keyManager),

View File

@@ -83,3 +83,10 @@ func WithSettings(settings CacheSettings) Option {
s.settings = settings.withDefaults()
}
}
// WithDiscoveryInvokeURI sets the invoke URI used when announcing the gateway.
func WithDiscoveryInvokeURI(invokeURI string) Option {
return func(s *Service) {
s.invokeURI = strings.TrimSpace(invokeURI)
}
}

View File

@@ -51,6 +51,7 @@ type Service struct {
drivers *drivers.Registry
commands commands.Registry
announcers []*discovery.Announcer
invokeURI string
connectorv1.UnimplementedConnectorServiceServer
}
@@ -209,7 +210,7 @@ func (s *Service) startDiscoveryAnnouncers() {
Network: network.Name,
Operations: []string{"balance.read", "payin.crypto", "payout.crypto", "fee.send"},
Currencies: currencies,
InvokeURI: discovery.DefaultInvokeURI(string(mservice.ChainGateway)),
InvokeURI: s.invokeURI,
Version: version,
}
announcer := discovery.NewAnnouncer(s.logger, s.producer, string(mservice.ChainGateway), announce)