Files
opencloud/pkg/nats/options.go
Jörn Friedrich Dreyer 7306abaaf9 add tls support for all nats connections
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
(cherry picked from commit 77fd4fca69)

Backports: https://github.com/opencloud-eu/opencloud/pull/2063
2026-06-22 14:33:10 +02:00

21 lines
339 B
Go

package nats
import (
"crypto/tls"
"github.com/nats-io/nats.go"
)
func Secure(enableTLS, insecure bool, rootCA string) nats.Option {
if enableTLS {
if rootCA != "" {
return nats.RootCAs(rootCA)
}
return nats.Secure(&tls.Config{
MinVersion: tls.VersionTLS12,
InsecureSkipVerify: insecure,
})
}
return nil
}