forked from TrueCloudLab/frostfs-node
Alex Vanin
20de74a505
Due to source code relocation from GitHub. Signed-off-by: Alex Vanin <a.vanin@yadro.com>
38 lines
745 B
Go
38 lines
745 B
Go
package nats
|
|
|
|
import (
|
|
"time"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
|
"github.com/nats-io/nats.go"
|
|
)
|
|
|
|
func WithClientCert(certPath, keyPath string) Option {
|
|
return func(o *opts) {
|
|
o.nOpts = append(o.nOpts, nats.ClientCert(certPath, keyPath))
|
|
}
|
|
}
|
|
|
|
func WithRootCA(paths ...string) Option {
|
|
return func(o *opts) {
|
|
o.nOpts = append(o.nOpts, nats.RootCAs(paths...))
|
|
}
|
|
}
|
|
|
|
func WithTimeout(timeout time.Duration) Option {
|
|
return func(o *opts) {
|
|
o.nOpts = append(o.nOpts, nats.Timeout(timeout))
|
|
}
|
|
}
|
|
|
|
func WithConnectionName(name string) Option {
|
|
return func(o *opts) {
|
|
o.nOpts = append(o.nOpts, nats.Name(name))
|
|
}
|
|
}
|
|
|
|
func WithLogger(logger *logger.Logger) Option {
|
|
return func(o *opts) {
|
|
o.log = logger
|
|
}
|
|
}
|