natsconf

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package natsconf helps configure NATS connections from a JSON/YAML configuration source.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name          string `json:"name"` // Optional client name for the connection
	URL           string `json:"url"`
	MaxReconnects int    `json:"max_reconnects"` // default -1
	ReconnectWait int    `json:"reconnect_wait"` // default 1000 (ms)
	Creds         string `json:"creds"`          // NKey with JWT credentials file
	TLS           struct {
		ServerName string `json:"server_name"`
		Cert       string `json:"cert"`
		Key        string `json:"key"`
		CA         string `json:"ca"`
	} `json:"tls"`
}

Config defines how to connect to the NATS servers.

func (*Config) CertificateOption

func (conf *Config) CertificateOption() (nats.Option, error)

CertificateOption generates a nats.Option for the configured TLS certificates.

func (*Config) Options

func (conf *Config) Options() ([]nats.Option, error)

Options generates an array of nats options based on the configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL