Documentation ¶
Index ¶
- func LoadConfigFromFile(configFile string, configStruct interface{}, strict bool) error
- func LoadConfigFromMap(m map[string]interface{}, configStruct interface{}, strict bool) error
- func LoadConfigFromString(configString string, configStruct interface{}, strict bool) error
- func ValidateDirPath(path string) (string, error)
- func ValidateFilePath(path string) (string, error)
- type AccountServerConfig
- type HTTPConfig
- type LogConfig
- type NATSConfig
- type StoreConfig
- type TLSConf
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadConfigFromFile ¶
LoadConfigFromFile - given a struct, load a config from a file and fill in the struct If strict is true, all of the fields in the config struct must be in the file otherwise, the fields in the config struct will act as defaults if the file doesn't contain them Strict will also force an error if the struct contains any fields which are not settable with reflection
func LoadConfigFromMap ¶
LoadConfigFromMap load a config struct from a map, this is useful if the type of a config isn't known at load time.
func LoadConfigFromString ¶
LoadConfigFromString - like LoadConfigFromFile but uses a string
func ValidateDirPath ¶
ValidateDirPath checks that the provided path exists and is a dir
func ValidateFilePath ¶
ValidateFilePath checks that the provided path exists and is not a dir
Types ¶
type AccountServerConfig ¶
type AccountServerConfig struct { Logging LogConfig NATS NATSConfig HTTP HTTPConfig Store StoreConfig OperatorJWTPath string SystemAccountJWTPath string SignRequestSubject string SignRequestTimeout int //milliseconds // Below options are only to copy jwt from an old account server for initialization Primary string ReplicationTimeout int //milliseconds MaxReplicationPack int // maximum number of JWTS to grab on startup }
AccountServerConfig is the root structure for an account server configuration file.
func DefaultServerConfig ¶
func DefaultServerConfig() *AccountServerConfig
DefaultServerConfig generates a default configuration with logging set to colors, time, debug and trace
type HTTPConfig ¶
type HTTPConfig struct { Host string Port int TLS TLSConf ReadTimeout int //milliseconds WriteTimeout int //milliseconds }
HTTPConfig is used to specify the host/port/tls for an HTTP server
type LogConfig ¶ added in v1.0.0
type LogConfig struct { Time bool Debug bool Trace bool Colors bool PID bool Custom natsserver.Logger }
LogConfig allows configuration of the logging details
type NATSConfig ¶
type NATSConfig struct { Servers []string ConnectTimeout int //milliseconds ReconnectWait int //milliseconds MaxReconnects int TLS TLSConf UserCredentials string }
NATSConfig configuration for a NATS connection
type StoreConfig ¶
type StoreConfig struct { Dir string // the path to a folder for mutable storage Shard bool // optional setting to shard the directory store, avoiding too many files in one folder CleanupInterval int // interval at which expiration is checked NSC string // removed support for this, keep so that we can warn when used ReadOnly bool // removed support for this, keep so that we can warn when used }
StoreConfig is a catch-all for the store options, the store created depends on the contents of the config: if NSC is set the read-only NSC store is used if Dir is set a folder store is used, mutability is based on ReadOnly otherwise a memory store is used, mutability is based on ReadOnly (which means the r/o store will be stuck empty)