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
- Variables
- func ClearLogConfigInstance()
- func GetApkHome() string
- func GetLogConfigPath() (string, error)
- func NewReceiver() chan string
- func NewSender() chan string
- func ReadLogConfigs() *pkgconf.LogConfig
- func SetConfig(conf *Config)
- func SetDefaultConfig()
- func UpdateLoggers()
- type Config
- type JwtUser
- type KeyPair
- type Metrics
- type WireLogConfig
Constants ¶
const ( //UnassignedAsDeprecated is used by the configurations which are deprecated. UnassignedAsDeprecated string = "unassigned-as-deprecated" )
Variables ¶
var (
C chan string // better to be interface{} type which could send any type of data.
)
C represents the channel to identify modifications added to the configuration file TODO: (VirajSalaka) remove this as unused.
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 returns the file location of the log-config path
func NewReceiver ¶
func NewReceiver() chan string
NewReceiver initializes the channel if it is not created an returns
func NewSender ¶
func NewSender() chan string
NewSender initializes the channel if it is not created an returns
func ReadLogConfigs ¶
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.
func SetConfig ¶
func SetConfig(conf *Config)
SetConfig sets the given configuration to the adapter configuration
func SetDefaultConfig ¶
func SetDefaultConfig()
SetDefaultConfig sets the default configuration to the adapter configuration
Types ¶
type Config ¶
type Config struct { Adapter adapter Enforcer enforcer Envoy envoy `toml:"router"` ManagementServer managementServer `toml:"managementServer"` PartitionServer partitionServer `toml:"partitionServer"` Analytics analytics `toml:"analytics"` Tracing tracing Deployment deployment }
Config represents the adapter configuration. It is created directly from the configuration toml file. Note :
Don't use toml tag for configuration properties as it may affect environment variable based config resolution.
func ReadConfigs ¶
func ReadConfigs() *Config
ReadConfigs implements adapter configuration read operation. The read operation will happen only once, hence the consistancy is ensured.
If the "APK_HOME" variable is set, the configuration file location would be picked relative to the variable's value ("/conf/config.toml"). otherwise, the "APK_HOME" variable would be set to the directory from where the executable is called from.
Returns the configuration object that is initialized with default values. Changes to the default configuration object is achieved through the configuration file.
type WireLogConfig ¶
WireLogConfig is the config holder for wire logs
func GetWireLogConfig ¶
func GetWireLogConfig() *WireLogConfig
GetWireLogConfig converts the wire log configs read from the config file