Documentation ¶
Overview ¶
Package config contains the implementation and data structures related to configurations and configuration (log and adapter config) parsing. If a new configuration is introduced to the adapter configuration file, the corresponding change needs to be added to the relevant data stucture as well.
Index ¶
Constants ¶
const (
// EnvConfigPrefix is used when configs should be read from environment variables.
EnvConfigPrefix = "$env"
)
Variables ¶
This section is empty.
Functions ¶
func ClearLogConfigInstance ¶
func ClearLogConfigInstance()
ClearLogConfigInstance removes the existing configuration. Then the log configuration can be re-initialized.
func GetApkHome ¶
func GetApkHome() string
GetApkHome reads the APK_HOME environmental variable and returns the value. This represent the directory where the distribution is located. If the env variable is not present, the directory from which the executable is triggered will be assigned.
func GetLogConfigPath ¶
GetLogConfigPath reads the LOG_CONFIG_PATH environmental variable and returns the value. If the env variable is not available, returned value would be the combination of APK_HOME env variable value + relative log config path Error would be returned if the logConfig file is not available
func ResolveConfigEnvValues ¶
ResolveConfigEnvValues looks for the string type config values which should be read from environment variables and replace the respective config values from environment variable. v - relect.Value of the root level struct previousTag - the starting Tag corresponding to the root level struct resolveEnvTag - true if $env{} annotation needs to be resolved at adapter level
func ResolveEnvValue ¶
ResolveEnvValue replace the respective config values from environment variable.
Types ¶
type LogConfig ¶
type LogConfig struct { Logfile string LogLevel string LogFormat string // log rotation parameters. Rotation struct { IP string Port string MaxSize int // megabytes MaxBackups int MaxAge int //days Compress bool } Pkg []pkg AccessLogs *accessLog WireLogs *wireLogs }
LogConfig represents the configurations related to adapter logs and envoy access logs.
func ReadLogConfigs ¶
func ReadLogConfigs() *LogConfig
ReadLogConfigs implements adapter/proxy log-configuration read operation.The read operation will happen only once, hence the consistancy is ensured.
If the "APK_HOME" variable is set, the log configuration file location would be picked relative to the variable's value ("/conf/log_config.toml"). otherwise, the "APK_HOME" variable would be set to the directory from where the executable is called from.
Returns the log configuration object mapped from the configuration file during the startup.