From 2f4bfab2bdfd0fd0037e9887fb1219d36fbbf140 Mon Sep 17 00:00:00 2001 From: SunilSKamath4s <61273144+SunilSKamath4s@users.noreply.github.com> Date: Wed, 8 Feb 2023 17:58:02 +0530 Subject: [PATCH] postmaster topic v2 changes --- protocols/pub/pubnub/pubnub.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/protocols/pub/pubnub/pubnub.go b/protocols/pub/pubnub/pubnub.go index 53847bf..0e5bc20 100644 --- a/protocols/pub/pubnub/pubnub.go +++ b/protocols/pub/pubnub/pubnub.go @@ -9,10 +9,11 @@ import ( type Config struct { SubscribeKey string PublishKey string + SecretKey string } func (c *Config) GetKeys() []string { - return []string{"subscribe_key", "publish_key"} + return []string{"subscribe_key", "publish_key", "secret_key"} } func (c *Config) GetMandatoryKeys() []string { @@ -25,6 +26,8 @@ func (c *Config) GetField(key string) string { return "SubscribeKey" case "publish_key": return "PublishKey" + case "secret_key": + return "SecretKey" default: return "" } @@ -48,6 +51,9 @@ func (pub *pubnubPub) Connect(configs map[string]interface{}) error { cfg := pubnub.NewConfig() cfg.SubscribeKey = config.SubscribeKey cfg.PublishKey = config.PublishKey + if config.SecretKey != "" { + cfg.SecretKey = config.SecretKey + } pub.Client = pubnub.NewPubNub(cfg) return err