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"` }
type ClusterConfig ¶
type ClusterConfig struct { Port int `json:"port,omitempty"` Routes []string `json:"routes,omitempty"` TLS *TLSConfig `json:"tls,omitempty"` Authorization *AuthorizationConfig `json:"authorization,omitempty"` }
type Permissions ¶ added in v0.2.2
type Permissions struct { Publish []string `json:"publish,omitempty"` Subscribe []string `json:"subscribe,omitempty"` }
Permissions are the allowed subjects on a per publish or subscribe basis.
type ServerConfig ¶
type ServerConfig struct { Host string `json:"host,omitempty"` Port int `json:"port,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"` WriteDeadline string `json:"write_deadline,omitempty"` MaxConnections int `json:"max_connections,omitempty"` MaxPayload int `json:"max_payload,omitempty"` Authorization *AuthorizationConfig `json:"authorization,omitempty"` LameDuckDuration string `json:"lame_duck_duration,omitempty"` Include string `json:"include,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"` }
type User ¶ added in v0.2.2
type User struct { User string `json:"username,omitempty"` Password string `json:"password,omitempty"` Permissions *Permissions `json:"permissions,omitempty"` }
Click to show internal directories.
Click to hide internal directories.