Nats tls (#4781)
* use tls for nats connections * add config options for nats client tls config * add nats tls config to CI * add function to create a certpool * add option to provide a rootCA to validate the server's TLS certificate * add option to provide a rootCA to validate the server's TLS certificate * add option to provide a rootCA to validate the server's TLS certificate * add option to provide a rootCA to validate the server's TLS certificate * configure nats clients in reva to use tls
This commit is contained in:
@@ -23,6 +23,7 @@ func NewNATSServer(ctx context.Context, logger nserver.Logger, opts ...NatsOptio
|
||||
|
||||
// enable JetStream
|
||||
natsOpts.JetStream = true
|
||||
natsOpts.AllowNonTLS = false
|
||||
|
||||
server, err := nserver.NewServer(natsOpts)
|
||||
if err != nil {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package nats
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
|
||||
nserver "github.com/nats-io/nats-server/v2/server"
|
||||
)
|
||||
|
||||
@@ -34,3 +36,10 @@ func StoreDir(StoreDir string) NatsOption {
|
||||
o.StoreDir = StoreDir
|
||||
}
|
||||
}
|
||||
|
||||
// TLSConfig sets the tls config for the nats server
|
||||
func TLSConfig(c *tls.Config) NatsOption {
|
||||
return func(o *nserver.Options) {
|
||||
o.TLSConfig = c
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user