config

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2022 License: MIT Imports: 5 Imported by: 4

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

View Source
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 Get

func Get() *BaseConfig

Get singleton instance

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) LogLevel

func (c *BaseConfig) LogLevel() string

Log level accessor

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL