mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-06-17 04:18:53 -04:00
21 lines
339 B
Go
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
|
|
}
|