Documentation ¶
Overview ¶
natsconf is a package for producing NATS config programmatically.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶
func Marshal(conf *ServerConfig) ([]byte, error)
Marshal takes a server configuration and returns its JSON representation in bytes.
Types ¶
type AuthorizationConfig ¶
type AuthorizationConfig struct { Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Token string `json:"token,omitempty"` Timeout int `json:"timeout,omitempty"` Users []*User `json:"users,omitempty"` DefaultPermissions *Permissions `json:"default_permissions,omitempty"` Include string `json:"include,omitempty"` }
type ClusterConfig ¶
type ClusterConfig struct { Name string `json:"name,omitempty"` Port int `json:"port,omitempty"` Routes []string `json:"routes,omitempty"` TLS *TLSConfig `json:"tls,omitempty"` Authorization *AuthorizationConfig `json:"authorization,omitempty"` }
type GatewayConfig ¶ added in v0.5.0
type GatewayConfig struct { Name string `json:"name,omitempty"` Host string `json:"addr,omitempty"` Port int `json:"port,omitempty"` TLS *TLSConfig `json:"tls,omitempty"` TLSTimeout float64 `json:"tls_timeout,omitempty"` Advertise string `json:"advertise,omitempty"` ConnectRetries int `json:"connect_retries,omitempty"` Gateways []*RemoteGatewayOpts `json:"gateways,omitempty"` RejectUnknown bool `json:"reject_unknown,omitempty"` Include string `json:"include,omitempty"` Authorization *AuthorizationConfig `json:"authorization,omitempty"` }
type LeafNodeRemote ¶ added in v0.7.4
type LeafNodeRemote struct { URLs []string `json:"urls,omitempty"` Credentials string `json:"credentials,omitempty"` }
LeafNodeRemote is the URL for remote NATS system.
type LeafNodeServerConfig ¶ added in v0.5.0
type Permissions ¶ added in v0.2.2
type Permissions struct { // Can be either a map with allow/deny or an array. Publish interface{} `json:"publish,omitempty"` Subscribe interface{} `json:"subscribe,omitempty"` }
Permissions are the allowed subjects on a per publish or subscribe basis.
type RemoteGatewayOpts ¶ added in v0.5.0
type ServerConfig ¶
type ServerConfig struct { Host string `json:"host,omitempty"` Port int `json:"port,omitempty"` ServerName string `json:"server_name,omitempty"` HTTPPort int `json:"http_port,omitempty"` HTTPSPort int `json:"https_port,omitempty"` Cluster *ClusterConfig `json:"cluster,omitempty"` TLS *TLSConfig `json:"tls,omitempty"` Debug bool `json:"debug,omitempty"` Trace bool `json:"trace,omitempty"` Logtime bool `json:"logtime"` WriteDeadline string `json:"write_deadline,omitempty"` MaxConnections int `json:"max_connections,omitempty"` MaxControlLine int `json:"max_control_line,omitempty"` MaxPayload int `json:"max_payload,omitempty"` MaxPending int `json:"max_pending,omitempty"` MaxSubscriptions int `json:"max_subscriptions,omitempty"` Authorization *AuthorizationConfig `json:"authorization,omitempty"` LameDuckDuration string `json:"lame_duck_duration,omitempty"` Include string `json:"include,omitempty"` Gateway *GatewayConfig `json:"gateway,omitempty"` LeafNode *LeafNodeServerConfig `json:"leaf,omitempty"` Websocket *WebsocketConfig `json:"websocket,omitempty"` JWT string `json:"operator,omitempty"` SystemAccount string `json:"system_account,omitempty"` Resolver string `json:"resolver,omitempty"` }
func Unmarshal ¶ added in v0.4.2
func Unmarshal(conf []byte) (*ServerConfig, error)
Unmarshal attempts to parse the specified byte array as JSON as a ServerConfig object.
type TLSConfig ¶
type TLSConfig struct { CAFile string `json:"ca_file,omitempty"` CertFile string `json:"cert_file,omitempty"` KeyFile string `json:"key_file,omitempty"` Verify bool `json:"verify,omitempty"` CipherSuites []string `json:"cipher_suites,omitempty"` CurvePreferences []string `json:"curve_preferences,omitempty"` Timeout float64 `json:"timeout,omitempty"` VerifyAndMap bool `json:"verify_and_map,omitempty"` }
Click to show internal directories.
Click to hide internal directories.