Documentation ¶
Overview ¶
Package config
Base configuration utility This utility is used to read configuration parameters from environment variables and expose them to the application parts as accessor methods.
The concrete application / service should inherit its own special configuration and extend the base configuration with added variables. The base configuration exposes some common configuration parameters used by the middleware components
Index ¶
- Constants
- type BaseConfig
- func (c *BaseConfig) AddOrUpdateConfigPair(key, value string)
- func (c *BaseConfig) GetAllKeysSorted() []string
- func (c *BaseConfig) GetAllVars() map[string]string
- func (c *BaseConfig) GetBoolParamValueOrDefault(key string, defaultValue bool) (val bool)
- func (c *BaseConfig) GetInt64ParamValueOrDefault(key string, defaultValue int64) (val int64)
- func (c *BaseConfig) GetIntParamValueOrDefault(key string, defaultValue int) (val int)
- func (c *BaseConfig) GetStringParamValueOrDefault(key string, defaultValue string) (val string)
- func (c *BaseConfig) HttpReadTimeoutMs() int
- func (c *BaseConfig) HttpWriteTimeoutMs() int
- func (c *BaseConfig) LogLevel() string
- func (c *BaseConfig) ScanEnvVariables()
- func (c *BaseConfig) WsKeepALiveInterval() int64
- func (c *BaseConfig) WsPongTimeoutSec() int
- func (c *BaseConfig) WsReadBufferSizeBytes() int
- func (c *BaseConfig) WsWriteBufferSizeBytes() int
- func (c *BaseConfig) WsWriteCompress() bool
- func (c *BaseConfig) WsWriteTimeoutSec() int
Constants ¶
const ( CfgLoglevel = "LOG_LEVEL" CfgHttpReadTimeoutMs = "HTTP_READ_TIMEOUT_MS" CfgHttpWriteTimeoutMs = "HTTP_WRITE_TIMEOUT_MS" CfgWsKeepAliveSec = "WS_KEEP_ALIVE_SEC" CfgWsReadBufferSizeBytes = "WS_READ_BUFFER_SIZE_BYTES" CfgWsWriteBufferSizeBytes = "WS_WRITE_BUFFER_SIZE_BYTES" CfgWsWriteCompress = "WS_WRITE_COMPRESS" CfgWsWriteTimeoutSec = "WS_WRITE_TIMEOUT" CfgWsPongTimeoutSec = "WS_PONG_TIMEOUT" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseConfig ¶
type BaseConfig struct {
// contains filtered or unexported fields
}
func (*BaseConfig) AddOrUpdateConfigPair ¶
func (c *BaseConfig) AddOrUpdateConfigPair(key, value string)
Add or update configuration key
func (*BaseConfig) GetAllKeysSorted ¶
func (c *BaseConfig) GetAllKeysSorted() []string
Get a list of all the configuration keys
func (*BaseConfig) GetAllVars ¶
func (c *BaseConfig) GetAllVars() map[string]string
Get a map of all the configuration variables and values
func (*BaseConfig) GetBoolParamValueOrDefault ¶
func (c *BaseConfig) GetBoolParamValueOrDefault(key string, defaultValue bool) (val bool)
Get environment variable as bool
func (*BaseConfig) GetInt64ParamValueOrDefault ¶
func (c *BaseConfig) GetInt64ParamValueOrDefault(key string, defaultValue int64) (val int64)
Get environment variable as int64
func (*BaseConfig) GetIntParamValueOrDefault ¶
func (c *BaseConfig) GetIntParamValueOrDefault(key string, defaultValue int) (val int)
Get environment variable as int
func (*BaseConfig) GetStringParamValueOrDefault ¶
func (c *BaseConfig) GetStringParamValueOrDefault(key string, defaultValue string) (val string)
Get environment variable as string
func (*BaseConfig) HttpReadTimeoutMs ¶
func (c *BaseConfig) HttpReadTimeoutMs() int
HTTP read time out
func (*BaseConfig) HttpWriteTimeoutMs ¶
func (c *BaseConfig) HttpWriteTimeoutMs() int
HTTP write time out
func (*BaseConfig) ScanEnvVariables ¶
func (c *BaseConfig) ScanEnvVariables()
Scan all environment variables and map their values to existing configuration keys
func (*BaseConfig) WsKeepALiveInterval ¶
func (c *BaseConfig) WsKeepALiveInterval() int64
Web socket keep alive interval (in seconds)
func (*BaseConfig) WsPongTimeoutSec ¶
func (c *BaseConfig) WsPongTimeoutSec() int
Web socket PONG time out un seconds
func (*BaseConfig) WsReadBufferSizeBytes ¶
func (c *BaseConfig) WsReadBufferSizeBytes() int
Web socket read buffer size
func (*BaseConfig) WsWriteBufferSizeBytes ¶
func (c *BaseConfig) WsWriteBufferSizeBytes() int
Web socket write buffer size
func (*BaseConfig) WsWriteCompress ¶
func (c *BaseConfig) WsWriteCompress() bool
Web socket compression on write
func (*BaseConfig) WsWriteTimeoutSec ¶
func (c *BaseConfig) WsWriteTimeoutSec() int
Web socket write time out in seconds