Documentation ¶
Overview ¶
Package config handles everything related to runtime-configuration.
Three configuration sources are supported. In order of ascending priority: configuration file, environment variables, command line arguments.
Index ¶
- Constants
- func FromCommandLineParams(args []string) (rawConf, []string, error)
- func FromEnvironment(env []string) rawConf
- func FromFile(configFile string) (rawConf, error)
- func RegisterBackend(bcp BackendConfig)
- type BackendConfig
- type Item
- type Opts
- func (c *Opts) AcceptedItems() []*Item
- func (c *Opts) AsEnvKeyValue() []string
- func (c *Opts) ConfigDir() string
- func (c *Opts) MergeIntoEnv(env []string) []string
- func (c *Opts) ShouldLogAny() bool
- func (c *Opts) ShouldLogDebug() bool
- func (c *Opts) ShouldLogInfo() bool
- func (c *Opts) ShouldLogTrace() bool
- func (c *Opts) ShouldLogWarnings() bool
- func (c *Opts) SocketDir() string
Constants ¶
View Source
const ( LOG_OFF = "off" LOG_WARN = "warn" LOG_INFO = "info" LOG_DEBUG = "debug" LOG_TRACE = "trace" )
View Source
const ( ENV_VAR_PREFIX = "__TILO_" CLI_VAR_PREFIX = "--" )
Variables ¶
This section is empty.
Functions ¶
func FromCommandLineParams ¶
Read a configuration from command line parameters.
func FromEnvironment ¶
func FromEnvironment(env []string) rawConf
Read a configuration from environment-compatible key=value pairs.
func RegisterBackend ¶
func RegisterBackend(bcp BackendConfig)
Types ¶
type BackendConfig ¶
type Opts ¶
type Opts struct { // The location of the configuration file. ConfFile Item // The protocol to use for server communication. Protocol Item // The name of the request socket file. Socket Item // The server's backend Backend Item // Determines the amount of additional log output. LogLevel Item }
Configuration parameters.
func (*Opts) AcceptedItems ¶
func (*Opts) AsEnvKeyValue ¶
Emit the configuration in a format suitable as environment variables.
func (*Opts) MergeIntoEnv ¶
Take a list of environment-compatible key=value pairs and add tilo-options.
func (*Opts) ShouldLogAny ¶
func (*Opts) ShouldLogDebug ¶
func (*Opts) ShouldLogInfo ¶
func (*Opts) ShouldLogTrace ¶
func (*Opts) ShouldLogWarnings ¶
Click to show internal directories.
Click to hide internal directories.