Skip to content

Commit

Permalink
Merge pull request #90 from mamadeusia/feature/support-nkey-natsjs
Browse files Browse the repository at this point in the history
support for setting the natjs bare nkey connection
  • Loading branch information
jochumdev authored Aug 7, 2023
2 parents f31dcd2 + 95fcf9c commit bc05fb0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions v4/events/natsjs/nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ func connectToNatsJetStream(options Options) (nats.JetStreamContext, error) {
nopts.Secure = true
nopts.TLSConfig = options.TLSConfig
}
if options.NkeyConfig != "" {
nopts.Nkey = options.NkeyConfig
}

if len(options.Address) > 0 {
nopts.Servers = strings.Split(options.Address, ",")
}
Expand Down
8 changes: 8 additions & 0 deletions v4/events/natsjs/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type Options struct {
ClusterID string
ClientID string
Address string
NkeyConfig string
TLSConfig *tls.Config
Logger logger.Logger
SyncPublish bool
Expand Down Expand Up @@ -48,6 +49,13 @@ func TLSConfig(t *tls.Config) Option {
}
}

// Nkey string to use when connecting to the cluster.
func NkeyConfig(nkey string) Option {
return func(o *Options) {
o.NkeyConfig = nkey
}
}

// Logger sets the underlyin logger
func Logger(log logger.Logger) Option {
return func(o *Options) {
Expand Down

0 comments on commit bc05fb0

Please sign in to comment.