From 06733a6b7d83d277e67b41dba8367e50a8c7a8d0 Mon Sep 17 00:00:00 2001 From: "ev.lekht" Date: Tue, 15 Oct 2024 18:52:47 +0400 Subject: [PATCH 1/6] add enable flag to rpc server and partner plugin configs --- config/config.go | 4 ++ config/config_reader.go | 1 + config/flags.go | 2 + config/test_config.yaml | 2 + ...mino-messenger-bot-distributor-camino.yaml | 4 ++ ...no-messenger-bot-distributor-columbus.yaml | 4 ++ .../camino-messenger-bot-supplier-camino.yaml | 20 ++++---- ...amino-messenger-bot-supplier-columbus.yaml | 20 ++++---- internal/app/app.go | 47 ++++++++++--------- internal/rpc/client/client.go | 4 ++ internal/rpc/server/server.go | 4 ++ 11 files changed, 74 insertions(+), 38 deletions(-) diff --git a/config/config.go b/config/config.go index 9532a6a2..fa12d4ac 100644 --- a/config/config.go +++ b/config/config.go @@ -49,6 +49,7 @@ type TracingConfig struct { } type PartnerPluginConfig struct { + Enabled bool HostURL url.URL Unencrypted bool CACertFile string @@ -70,6 +71,7 @@ type DBConfig struct { } type RPCServerConfig struct { + Enabled bool `mapstructure:"enabled"` Port uint64 `mapstructure:"port"` Unencrypted bool `mapstructure:"unencrypted"` ServerCertFile string `mapstructure:"cert_file"` @@ -115,6 +117,7 @@ type UnparsedTracingConfig struct { } type UnparsedPartnerPluginConfig struct { + Enabled bool `mapstructure:"enabled"` Host string `mapstructure:"host"` Unencrypted bool `mapstructure:"unencrypted"` CACertFile string `mapstructure:"ca_file"` @@ -137,6 +140,7 @@ func (cfg *Config) unparse() *UnparsedConfig { KeyFile: cfg.Tracing.KeyFile, }, PartnerPlugin: UnparsedPartnerPluginConfig{ + Enabled: cfg.PartnerPlugin.Enabled, Host: cfg.PartnerPlugin.HostURL.String(), Unencrypted: cfg.PartnerPlugin.Unencrypted, CACertFile: cfg.PartnerPlugin.CACertFile, diff --git a/config/config_reader.go b/config/config_reader.go index 3e5821c8..bc1b4da8 100644 --- a/config/config_reader.go +++ b/config/config_reader.go @@ -131,6 +131,7 @@ func (cr *reader) parseConfig(cfg *UnparsedConfig) (*Config, error) { KeyFile: cfg.Tracing.KeyFile, }, PartnerPlugin: PartnerPluginConfig{ + Enabled: cfg.PartnerPlugin.Enabled, HostURL: *partnerPluginHost, Unencrypted: cfg.PartnerPlugin.Unencrypted, CACertFile: cfg.PartnerPlugin.CACertFile, diff --git a/config/flags.go b/config/flags.go index 111c5871..e7b1f9a5 100644 --- a/config/flags.go +++ b/config/flags.go @@ -41,11 +41,13 @@ func Flags() *pflag.FlagSet { flags.String("tracing.key_file", "", "The tracing key file.") // Partner plugin config flags + flags.Bool("partner_plugin.enabled", false, "Whether the RPC client is enabled or not.") flags.String("partner_plugin.host", "localhost:50051", "partner plugin RPC server host.") flags.Bool("partner_plugin.unencrypted", false, "Whether the RPC client should initiate an unencrypted connection with the server.") flags.String("partner_plugin.ca_file", "", "The partner plugin RPC server CA certificate file.") // RPC server config flags + flags.Bool("rpc_server.enabled", false, "Whether the RPC server is enabled or not.") flags.Uint64("rpc_server.port", 9090, "The RPC server port.") flags.Bool("rpc_server.unencrypted", false, "Whether the RPC server should be unencrypted.") flags.String("rpc_server.cert_file", "", "The server certificate file.") diff --git a/config/test_config.yaml b/config/test_config.yaml index cc371076..7430a124 100644 --- a/config/test_config.yaml +++ b/config/test_config.yaml @@ -17,11 +17,13 @@ network_fee_recipient_bot_address: 0xff6BAC3d972680515cbB59fCB6Db6deB13Eb0E91 network_fee_recipient_cm_account: 0xF6bA5c68A505559c170dC7a30448Ed64D8b9Bc3B partner_plugin: ca_file: ca-cert.pem + enabled: true host: localhost:50051 unencrypted: true response_timeout: 10000 rpc_server: cert_file: server-cert.pem + enabled: true key_file: server-key.pem port: 9090 unencrypted: true diff --git a/examples/config/camino-messenger-bot-distributor-camino.yaml b/examples/config/camino-messenger-bot-distributor-camino.yaml index 6f152774..2cd87e11 100644 --- a/examples/config/camino-messenger-bot-distributor-camino.yaml +++ b/examples/config/camino-messenger-bot-distributor-camino.yaml @@ -71,6 +71,8 @@ matrix: ### Partner Plugin (NOT USED FOR DISTRIBUTOR BOT) # partner_plugin: +# enabled: false + # # Partner Plugin hostname and port, should be reachable from this machine. # # Bot tries to connect to this host and port to relay messages that it receives from # # the distributors through Matrix Server @@ -86,6 +88,8 @@ matrix: ### RPC server rpc_server: + enabled: true + # Listen on this port for incoming RPC requests port: 9090 diff --git a/examples/config/camino-messenger-bot-distributor-columbus.yaml b/examples/config/camino-messenger-bot-distributor-columbus.yaml index 6ea42f87..cc327a65 100644 --- a/examples/config/camino-messenger-bot-distributor-columbus.yaml +++ b/examples/config/camino-messenger-bot-distributor-columbus.yaml @@ -71,6 +71,8 @@ matrix: ### Partner Plugin (NOT USED FOR DISTRIBUTOR BOT) # partner_plugin: +# enabled: false + # # Partner Plugin hostname and port, should be reachable from this machine. # # Bot tries to connect to this host and port to relay messages that it receives from # # the distributors through Matrix Server @@ -86,6 +88,8 @@ matrix: ### RPC server rpc_server: + enabled: true + # Listen on this port for incoming RPC requests port: 9090 diff --git a/examples/config/camino-messenger-bot-supplier-camino.yaml b/examples/config/camino-messenger-bot-supplier-camino.yaml index 65834382..573b2547 100644 --- a/examples/config/camino-messenger-bot-supplier-camino.yaml +++ b/examples/config/camino-messenger-bot-supplier-camino.yaml @@ -71,6 +71,8 @@ matrix: ### Partner Plugin partner_plugin: + enabled: true + # Partner Plugin hostname and port, should be reachable from this machine. # Bot tries to connect to this host and port to relay messages that it receives from # the distributors through Matrix Server @@ -84,16 +86,18 @@ partner_plugin: -### RPC server -rpc_server: - # Listen on this port for incoming RPC requests - port: 9090 +### RPC server (NOT USED FOR SUPPLIER BOT) +# rpc_server: +# enabled: false - # TLS configuration - unencrypted: true +# # Listen on this port for incoming RPC requests +# port: 9090 + +# # TLS configuration +# unencrypted: true - cert_file: server-cert.pem - key_file: server-key.pem +# cert_file: server-cert.pem +# key_file: server-key.pem diff --git a/examples/config/camino-messenger-bot-supplier-columbus.yaml b/examples/config/camino-messenger-bot-supplier-columbus.yaml index cf6dde2a..bb91b593 100644 --- a/examples/config/camino-messenger-bot-supplier-columbus.yaml +++ b/examples/config/camino-messenger-bot-supplier-columbus.yaml @@ -71,6 +71,8 @@ matrix: ### Partner Plugin partner_plugin: + enabled: true + # Partner Plugin hostname and port, should be reachable from this machine. # Bot tries to connect to this host and port to relay messages that it receives from # the distributors through Matrix Server @@ -84,16 +86,18 @@ partner_plugin: -### RPC server -rpc_server: - # Listen on this port for incoming RPC requests - port: 9090 +### RPC server (NOT USED FOR SUPPLIER BOT) +# rpc_server: +# enabled: false - # TLS configuration - unencrypted: true +# # Listen on this port for incoming RPC requests +# port: 9090 - cert_file: server-cert.pem - key_file: server-key.pem +# # TLS configuration +# unencrypted: true + +# cert_file: server-cert.pem +# key_file: server-key.pem diff --git a/internal/app/app.go b/internal/app/app.go index d343738c..67deffbb 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -63,13 +63,10 @@ func NewApp(ctx context.Context, cfg *config.Config, logger *zap.SugaredLogger) } // partner-plugin rpc client - var rpcClient *client.RPCClient - if cfg.PartnerPlugin.HostURL.String() != "" { - rpcClient, err = client.NewClient(cfg.PartnerPlugin, logger) - if err != nil { - logger.Errorf("Failed to create rpc client: %v", err) - return nil, err - } + rpcClient, err := client.NewClient(cfg.PartnerPlugin, logger) + if err != nil { + logger.Errorf("Failed to create rpc client: %v", err) + return nil, err } // register supported services, check if they actually supported by bot @@ -84,8 +81,8 @@ func NewApp(ctx context.Context, cfg *config.Config, logger *zap.SugaredLogger) return nil, err } - if !hasSupportedServices && rpcClient != nil { - logger.Warn("Bot doesn't support any services, but has partner plugin rpc client configured") + if !hasSupportedServices && cfg.PartnerPlugin.Enabled { + logger.Warn("Bot doesn't support any services, but has partner plugin rpc client enabled") } // messaging components @@ -207,10 +204,12 @@ func (a *App) Run(ctx context.Context) error { // run - g.Go(func() error { - a.logger.Info("Starting gRPC server...") - return a.rpcServer.Start() - }) + if a.rpcServer != nil { // rpcServer will be nil, if its disabled in config + g.Go(func() error { + a.logger.Info("Starting gRPC server...") + return a.rpcServer.Start() + }) + } g.Go(func() error { a.logger.Info("Starting start-up cash-in status check...") @@ -252,16 +251,20 @@ func (a *App) Run(ctx context.Context) error { // stop // <-gCtx.Done() means that all "run" goroutines are finished - g.Go(func() error { - <-ctx.Done() - return a.rpcClient.Shutdown() - }) + if a.rpcClient != nil { // rpcClient will be nil, if its disabled in partner plugin config section + g.Go(func() error { + <-ctx.Done() + return a.rpcClient.Shutdown() + }) + } - g.Go(func() error { - <-ctx.Done() - a.rpcServer.Stop() - return nil - }) + if a.rpcServer != nil { // rpcServer will be nil, if its disabled in config + g.Go(func() error { + <-ctx.Done() + a.rpcServer.Stop() + return nil + }) + } g.Go(func() error { <-ctx.Done() diff --git a/internal/rpc/client/client.go b/internal/rpc/client/client.go index 6cb3929c..b9cb2240 100644 --- a/internal/rpc/client/client.go +++ b/internal/rpc/client/client.go @@ -20,6 +20,10 @@ type RPCClient struct { } func NewClient(cfg config.PartnerPluginConfig, logger *zap.SugaredLogger) (*RPCClient, error) { + if !cfg.Enabled { + return nil, nil + } + var opts []grpc.DialOption if cfg.Unencrypted { opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) diff --git a/internal/rpc/server/server.go b/internal/rpc/server/server.go index 1bf84cd7..6224f19c 100644 --- a/internal/rpc/server/server.go +++ b/internal/rpc/server/server.go @@ -38,6 +38,10 @@ func NewServer( processor messaging.Processor, serviceRegistry messaging.ServiceRegistry, ) (Server, error) { + if !cfg.Enabled { + return nil, nil + } + var opts []grpc.ServerOption if cfg.Unencrypted { logger.Warn("Running gRPC server without TLS!") From ffda261b6c7aba575a13590fbe7ea53ebf70db27 Mon Sep 17 00:00:00 2001 From: "ev.lekht" Date: Tue, 15 Oct 2024 19:02:38 +0400 Subject: [PATCH 2/6] fix config reader / logging --- cmd/camino_messenger_bot.go | 33 ++++++++++++------- config/config_reader.go | 15 ++++----- config/config_reader_test.go | 5 +-- .../camino-messenger-bot-supplier-camino.yaml | 2 +- ...amino-messenger-bot-supplier-columbus.yaml | 2 +- 5 files changed, 34 insertions(+), 23 deletions(-) diff --git a/cmd/camino_messenger_bot.go b/cmd/camino_messenger_bot.go index 2bf8ce02..4201c60a 100644 --- a/cmd/camino_messenger_bot.go +++ b/cmd/camino_messenger_bot.go @@ -28,9 +28,29 @@ var rootCmd = &cobra.Command{ } func rootFunc(cmd *cobra.Command, _ []string) error { - configReader := config.NewConfigReader(cmd.Flags()) + configReaderLogger, err := zap.NewProduction() + if err != nil { + return fmt.Errorf("failed to create config-reader logger: %w", err) + } + + sugaredConfigReaderLogger := configReaderLogger.Sugar() + defer func() { _ = sugaredConfigReaderLogger.Sync() }() + + configReader, err := config.NewConfigReader(cmd.Flags(), sugaredConfigReaderLogger) + if err != nil { + return fmt.Errorf("failed to create config reader: %w", err) + } + + ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + defer stop() + + cfg, err := configReader.ReadConfig() + if err != nil { + return fmt.Errorf("failed to read config: %w", err) + } + + sugaredConfigReaderLogger.Sync() - var err error var zapLogger *zap.Logger if configReader.IsDevelopmentMode() { zapLogger, err = zap.NewDevelopment() @@ -46,15 +66,6 @@ func rootFunc(cmd *cobra.Command, _ []string) error { logger.Infof("App version: %s (git: %s)", Version, GitCommit) - ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) - defer stop() - - cfg, err := configReader.ReadConfig(logger) - if err != nil { - logger.Error(err) - return err - } - app, err := app.NewApp(ctx, cfg, logger) if err != nil { logger.Error(err) diff --git a/config/config_reader.go b/config/config_reader.go index bc1b4da8..20bd1dee 100644 --- a/config/config_reader.go +++ b/config/config_reader.go @@ -26,15 +26,16 @@ var ( type Reader interface { IsDevelopmentMode() bool - ReadConfig(logger *zap.SugaredLogger) (*Config, error) + ReadConfig() (*Config, error) } // Returns a new config reader. -func NewConfigReader(flags *pflag.FlagSet) Reader { +func NewConfigReader(flags *pflag.FlagSet, logger *zap.SugaredLogger) (Reader, error) { return &reader{ - viper: viper.New(), - flags: flags, - } + viper: viper.New(), + flags: flags, + logger: logger, + }, nil } type reader struct { @@ -47,9 +48,7 @@ func (cr *reader) IsDevelopmentMode() bool { return cr.viper.GetBool(flagKeyDeveloperMode) } -func (cr *reader) ReadConfig(logger *zap.SugaredLogger) (*Config, error) { - cr.logger = logger - +func (cr *reader) ReadConfig() (*Config, error) { cr.viper.SetEnvPrefix(envPrefix) cr.viper.AutomaticEnv() cr.viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) diff --git a/config/config_reader_test.go b/config/config_reader_test.go index 6c758bd5..bfeecdd2 100644 --- a/config/config_reader_test.go +++ b/config/config_reader_test.go @@ -62,10 +62,11 @@ func TestReadConfig(t *testing.T) { for name, tt := range tests { t.Run(name, func(t *testing.T) { - cr := NewConfigReader(tt.flags) + cr, err := NewConfigReader(tt.flags, zap.NewNop().Sugar()) + require.NoError(t, err) tt.prepare(t, cr.(*reader)) - config, err := cr.ReadConfig(zap.NewNop().Sugar()) + config, err := cr.ReadConfig() require.ErrorIs(t, err, tt.expectedErr) require.NoError(t, unsetEnvFromMap(envPrefix, rawMap)) diff --git a/examples/config/camino-messenger-bot-supplier-camino.yaml b/examples/config/camino-messenger-bot-supplier-camino.yaml index 573b2547..8832908c 100644 --- a/examples/config/camino-messenger-bot-supplier-camino.yaml +++ b/examples/config/camino-messenger-bot-supplier-camino.yaml @@ -86,7 +86,7 @@ partner_plugin: -### RPC server (NOT USED FOR SUPPLIER BOT) +### RPC server (NOT USED FOR SUPPLIER BOT IN THIS VERSION) # rpc_server: # enabled: false diff --git a/examples/config/camino-messenger-bot-supplier-columbus.yaml b/examples/config/camino-messenger-bot-supplier-columbus.yaml index bb91b593..f6cd62ab 100644 --- a/examples/config/camino-messenger-bot-supplier-columbus.yaml +++ b/examples/config/camino-messenger-bot-supplier-columbus.yaml @@ -86,7 +86,7 @@ partner_plugin: -### RPC server (NOT USED FOR SUPPLIER BOT) +### RPC server (NOT USED FOR SUPPLIER BOT IN THIS VERSION) # rpc_server: # enabled: false From 0fc047a6616b36c306e159017c23930f87664c16 Mon Sep 17 00:00:00 2001 From: "ev.lekht" Date: Tue, 15 Oct 2024 19:08:06 +0400 Subject: [PATCH 3/6] lint fix --- cmd/camino_messenger_bot.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/camino_messenger_bot.go b/cmd/camino_messenger_bot.go index 4201c60a..832cb54c 100644 --- a/cmd/camino_messenger_bot.go +++ b/cmd/camino_messenger_bot.go @@ -49,7 +49,7 @@ func rootFunc(cmd *cobra.Command, _ []string) error { return fmt.Errorf("failed to read config: %w", err) } - sugaredConfigReaderLogger.Sync() + _ = sugaredConfigReaderLogger.Sync() var zapLogger *zap.Logger if configReader.IsDevelopmentMode() { From 4f3a6ab829a6d7892e2e13b12821511be5824244 Mon Sep 17 00:00:00 2001 From: "ev.lekht" Date: Tue, 15 Oct 2024 19:40:50 +0400 Subject: [PATCH 4/6] fix --- internal/app/app.go | 6 +-- internal/messaging/service_registry.go | 56 +++++++++++++++----------- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/internal/app/app.go b/internal/app/app.go index 67deffbb..5dd61ab6 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -70,7 +70,7 @@ func NewApp(ctx context.Context, cfg *config.Config, logger *zap.SugaredLogger) } // register supported services, check if they actually supported by bot - serviceRegistry, hasSupportedServices, err := messaging.NewServiceRegistry( + serviceRegistry, err := messaging.NewServiceRegistry( cfg.CMAccountAddress, evmClient, logger, @@ -81,10 +81,6 @@ func NewApp(ctx context.Context, cfg *config.Config, logger *zap.SugaredLogger) return nil, err } - if !hasSupportedServices && cfg.PartnerPlugin.Enabled { - logger.Warn("Bot doesn't support any services, but has partner plugin rpc client enabled") - } - // messaging components responseHandler, err := messaging.NewResponseHandler( cfg.BotKey, diff --git a/internal/messaging/service_registry.go b/internal/messaging/service_registry.go index b88e4a4e..77e9fe67 100644 --- a/internal/messaging/service_registry.go +++ b/internal/messaging/service_registry.go @@ -34,51 +34,59 @@ func NewServiceRegistry( evmClient *ethclient.Client, logger *zap.SugaredLogger, rpcClient *client.RPCClient, -) (ServiceRegistry, bool, error) { +) (ServiceRegistry, error) { cmAccount, err := cmaccount.NewCmaccount(cmAccountAddress, evmClient) if err != nil { - return nil, false, fmt.Errorf("failed to fetch CM account: %w", err) + return nil, fmt.Errorf("failed to fetch CM account: %w", err) } supportedServices, err := cmAccount.GetSupportedServices(&bind.CallOpts{}) if err != nil { - return nil, false, fmt.Errorf("failed to fetch Registered services: %w", err) + return nil, fmt.Errorf("failed to fetch Registered services: %w", err) } hasSupportedServices := len(supportedServices.ServiceNames) > 0 - if hasSupportedServices && rpcClient == nil { - return nil, false, fmt.Errorf("bot supports some services, but doesn't have partner plugin rpc client configured") - } + partnerPluginClientEnabled := rpcClient != nil + var services map[types.MessageType]rpc.Service + + switch { + case hasSupportedServices && !partnerPluginClientEnabled: + return nil, fmt.Errorf("bot supports some services, but doesn't have partner plugin rpc client enabled") + case !hasSupportedServices && partnerPluginClientEnabled: + logger.Warn("Bot doesn't support any services, but has partner plugin rpc client enabled") + case hasSupportedServices && partnerPluginClientEnabled: // register supported services + servicesNames := make(map[string]struct{}, len(supportedServices.ServiceNames)) + + logStr := "\nSupported services:\n" + for _, serviceName := range supportedServices.ServiceNames { + logStr += serviceName + "\n" + servicesNames[serviceName] = struct{}{} + } - servicesNames := make(map[string]struct{}, len(supportedServices.ServiceNames)) - logStr := "\nSupported services:\n" - for _, serviceName := range supportedServices.ServiceNames { - logStr += serviceName + "\n" - servicesNames[serviceName] = struct{}{} - } - logStr += "\n" - logger.Info(logStr) + logStr += "\n" + logger.Info(logStr) - services := generated.RegisterClientServices(rpcClient.ClientConn, servicesNames) + if len(servicesNames) > 0 { + logger.Error(errUnsupportedService) - if len(servicesNames) > 0 { - logger.Error(errUnsupportedService) + logStr := "\nUnsupported services:\n" + for serviceName := range servicesNames { + logStr += serviceName + "\n" + } + logStr += "\n" + logger.Warn(logStr) - logStr := "\nUnsupported services:\n" - for serviceName := range servicesNames { - logStr += serviceName + "\n" + return nil, errUnsupportedService } - logStr += "\n" - logger.Warn(logStr) - return nil, false, errUnsupportedService + services = generated.RegisterClientServices(rpcClient.ClientConn, servicesNames) } return &serviceRegistry{ logger: logger, services: services, rpcClient: rpcClient, - }, hasSupportedServices, nil + }, nil } type serviceRegistry struct { From 0fd18e3e7cd344006e0d378d8c4ac6f7a5e502c8 Mon Sep 17 00:00:00 2001 From: "ev.lekht" Date: Tue, 15 Oct 2024 19:44:41 +0400 Subject: [PATCH 5/6] fix --- internal/messaging/service_registry.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/messaging/service_registry.go b/internal/messaging/service_registry.go index 77e9fe67..f5e0f8cf 100644 --- a/internal/messaging/service_registry.go +++ b/internal/messaging/service_registry.go @@ -63,6 +63,8 @@ func NewServiceRegistry( servicesNames[serviceName] = struct{}{} } + services = generated.RegisterClientServices(rpcClient.ClientConn, servicesNames) + logStr += "\n" logger.Info(logStr) @@ -78,8 +80,6 @@ func NewServiceRegistry( return nil, errUnsupportedService } - - services = generated.RegisterClientServices(rpcClient.ClientConn, servicesNames) } return &serviceRegistry{ From f27f74d09cc3146746310fc4446b7266231a493e Mon Sep 17 00:00:00 2001 From: "ev.lekht" Date: Tue, 15 Oct 2024 20:06:04 +0400 Subject: [PATCH 6/6] extend rpc enable flags description --- config/flags.go | 4 ++-- examples/config/camino-messenger-bot-distributor-camino.yaml | 2 ++ .../config/camino-messenger-bot-distributor-columbus.yaml | 2 ++ examples/config/camino-messenger-bot-supplier-camino.yaml | 2 ++ examples/config/camino-messenger-bot-supplier-columbus.yaml | 2 ++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/config/flags.go b/config/flags.go index e7b1f9a5..d0056445 100644 --- a/config/flags.go +++ b/config/flags.go @@ -41,13 +41,13 @@ func Flags() *pflag.FlagSet { flags.String("tracing.key_file", "", "The tracing key file.") // Partner plugin config flags - flags.Bool("partner_plugin.enabled", false, "Whether the RPC client is enabled or not.") + flags.Bool("partner_plugin.enabled", false, "Enable or disable the partner plugin rpc client. It must be enabled if bot's cm account supports at least one service.") flags.String("partner_plugin.host", "localhost:50051", "partner plugin RPC server host.") flags.Bool("partner_plugin.unencrypted", false, "Whether the RPC client should initiate an unencrypted connection with the server.") flags.String("partner_plugin.ca_file", "", "The partner plugin RPC server CA certificate file.") // RPC server config flags - flags.Bool("rpc_server.enabled", false, "Whether the RPC server is enabled or not.") + flags.Bool("rpc_server.enabled", false, "Enable or disable RPC server. It must be enabled if bot is expecting to receive RPC requests (e.g. its distributor bot).") flags.Uint64("rpc_server.port", 9090, "The RPC server port.") flags.Bool("rpc_server.unencrypted", false, "Whether the RPC server should be unencrypted.") flags.String("rpc_server.cert_file", "", "The server certificate file.") diff --git a/examples/config/camino-messenger-bot-distributor-camino.yaml b/examples/config/camino-messenger-bot-distributor-camino.yaml index 2cd87e11..49dc1ba0 100644 --- a/examples/config/camino-messenger-bot-distributor-camino.yaml +++ b/examples/config/camino-messenger-bot-distributor-camino.yaml @@ -71,6 +71,7 @@ matrix: ### Partner Plugin (NOT USED FOR DISTRIBUTOR BOT) # partner_plugin: +# # Enable or disable the partner plugin rpc client. It must be enabled if bot's cm account supports at least one service. # enabled: false # # Partner Plugin hostname and port, should be reachable from this machine. @@ -88,6 +89,7 @@ matrix: ### RPC server rpc_server: + # Enable or disable RPC server. It must be enabled if bot is expecting to receive RPC requests (e.g. its distributor bot). enabled: true # Listen on this port for incoming RPC requests diff --git a/examples/config/camino-messenger-bot-distributor-columbus.yaml b/examples/config/camino-messenger-bot-distributor-columbus.yaml index cc327a65..6818c812 100644 --- a/examples/config/camino-messenger-bot-distributor-columbus.yaml +++ b/examples/config/camino-messenger-bot-distributor-columbus.yaml @@ -71,6 +71,7 @@ matrix: ### Partner Plugin (NOT USED FOR DISTRIBUTOR BOT) # partner_plugin: +# # Enable or disable the partner plugin rpc client. It must be enabled if bot's cm account supports at least one service. # enabled: false # # Partner Plugin hostname and port, should be reachable from this machine. @@ -88,6 +89,7 @@ matrix: ### RPC server rpc_server: + # Enable or disable RPC server. It must be enabled if bot is expecting to receive RPC requests (e.g. its distributor bot). enabled: true # Listen on this port for incoming RPC requests diff --git a/examples/config/camino-messenger-bot-supplier-camino.yaml b/examples/config/camino-messenger-bot-supplier-camino.yaml index 8832908c..e19bc63d 100644 --- a/examples/config/camino-messenger-bot-supplier-camino.yaml +++ b/examples/config/camino-messenger-bot-supplier-camino.yaml @@ -71,6 +71,7 @@ matrix: ### Partner Plugin partner_plugin: + # Enable or disable the partner plugin rpc client. It must be enabled if bot's cm account supports at least one service. enabled: true # Partner Plugin hostname and port, should be reachable from this machine. @@ -88,6 +89,7 @@ partner_plugin: ### RPC server (NOT USED FOR SUPPLIER BOT IN THIS VERSION) # rpc_server: +# # Enable or disable RPC server. It must be enabled if bot is expecting to receive RPC requests (e.g. its distributor bot). # enabled: false # # Listen on this port for incoming RPC requests diff --git a/examples/config/camino-messenger-bot-supplier-columbus.yaml b/examples/config/camino-messenger-bot-supplier-columbus.yaml index f6cd62ab..8b29eb90 100644 --- a/examples/config/camino-messenger-bot-supplier-columbus.yaml +++ b/examples/config/camino-messenger-bot-supplier-columbus.yaml @@ -71,6 +71,7 @@ matrix: ### Partner Plugin partner_plugin: + # Enable or disable the partner plugin rpc client. It must be enabled if bot's cm account supports at least one service. enabled: true # Partner Plugin hostname and port, should be reachable from this machine. @@ -88,6 +89,7 @@ partner_plugin: ### RPC server (NOT USED FOR SUPPLIER BOT IN THIS VERSION) # rpc_server: +# # Enable or disable RPC server. It must be enabled if bot is expecting to receive RPC requests (e.g. its distributor bot). # enabled: false # # Listen on this port for incoming RPC requests