bump reva

Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
jkoberg
2023-08-16 10:20:22 +02:00
parent 49cdcad129
commit 450801deef
12 changed files with 72 additions and 169 deletions
+7
View File
@@ -52,10 +52,17 @@ 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, ",")
}
if options.Name != "" {
nopts.Name = options.Name
}
conn, err := nopts.Connect()
if err != nil {
return nil, fmt.Errorf("error connecting to nats at %v with tls enabled (%v): %v", options.Address, nopts.TLSConfig != nil, err)
+16
View File
@@ -11,9 +11,11 @@ type Options struct {
ClusterID string
ClientID string
Address string
NkeyConfig string
TLSConfig *tls.Config
Logger logger.Logger
SyncPublish bool
Name string
}
// Option is a function which configures options.
@@ -47,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) {
@@ -60,3 +69,10 @@ func SynchronousPublish(sync bool) Option {
o.SyncPublish = sync
}
}
// Name allows to add a name to the natsjs connection
func Name(name string) Option {
return func(o *Options) {
o.Name = name
}
}