config

package
v2.7.4 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWS

type AWS struct {
	AccessKeyID     string `yaml:"access_key_id"`
	SecretAccessKey string `yaml:"secret_access_key"`
	Endpoint        string `yaml:"endpoint"`
	Region          string `yaml:"region"`
	Bucket          string `yaml:"bucket"`
	FolderName      string `yaml:"folder_name"`
	ContentType     string `yaml:"content_type"`
}

AWS struct.

type Config

type Config struct {
	HTTPClientConfig *HTTPClientConfig `yaml:"http_client"`
	ConfigAWS        AWS               `yaml:"config_aws"`
	TransportInfo    Info              `yaml:"transport_info"`
	HTTPServer       HTTPServerConfig  `yaml:"http_server"`
	ZabbixConfig     ZabbixConfig      `yaml:"zabbix"`
	Version          string            `yaml:"version"`
	SentryDSN        string            `yaml:"sentry_dsn"`
	Database         DatabaseConfig    `yaml:"database"`
	UpdateInterval   int               `yaml:"update_interval"`
	LogLevel         logging.Level     `yaml:"log_level"`
	Debug            bool              `yaml:"debug"`
}

Config struct.

func NewConfig

func NewConfig(path string) *Config

NewConfig reads configuration file and returns config instance Usage:

NewConfig("config.yml")

func (Config) GetAWSConfig

func (c Config) GetAWSConfig() AWS

GetAWSConfig AWS configuration.

func (*Config) GetConfigData

func (c *Config) GetConfigData(path string) []byte

GetConfigData returns config file data in form of byte sequence.

func (Config) GetDBConfig

func (c Config) GetDBConfig() DatabaseConfig

GetDBConfig database configuration.

func (Config) GetHTTPClientConfig

func (c Config) GetHTTPClientConfig() *HTTPClientConfig

GetHTTPClientConfig returns http client config.

func (Config) GetHTTPConfig

func (c Config) GetHTTPConfig() HTTPServerConfig

GetHTTPConfig server configuration.

func (Config) GetLogLevel

func (c Config) GetLogLevel() logging.Level

GetLogLevel log level.

func (Config) GetSentryDSN

func (c Config) GetSentryDSN() string

GetSentryDSN sentry connection dsn.

func (Config) GetTransportInfo

func (c Config) GetTransportInfo() InfoInterface

GetTransportInfo transport basic data.

func (Config) GetUpdateInterval

func (c Config) GetUpdateInterval() int

GetUpdateInterval user data update interval.

func (Config) GetVersion

func (c Config) GetVersion() string

GetVersion transport version.

func (Config) GetZabbixConfig added in v2.6.4

func (c Config) GetZabbixConfig() ZabbixConfig

GetZabbixConfig returns zabbix configuration.

func (Config) IsDebug

func (c Config) IsDebug() bool

IsDebug debug flag.

func (*Config) LoadConfig

func (c *Config) LoadConfig(path string) *Config

LoadConfig read & load configuration file.

func (*Config) LoadConfigFromData

func (c *Config) LoadConfigFromData(data []byte) *Config

LoadConfigFromData loads config from byte sequence.

type Configuration

type Configuration interface {
	GetVersion() string
	GetSentryDSN() string
	GetLogLevel() logging.Level
	GetHTTPConfig() HTTPServerConfig
	GetZabbixConfig() ZabbixConfig
	GetDBConfig() DatabaseConfig
	GetAWSConfig() AWS
	GetTransportInfo() InfoInterface
	GetHTTPClientConfig() *HTTPClientConfig
	GetUpdateInterval() int
	IsDebug() bool
}

Configuration settings data structure.

type DatabaseConfig

type DatabaseConfig struct {
	Connection         interface{} `yaml:"connection"`
	TablePrefix        string      `yaml:"table_prefix"`
	MaxOpenConnections int         `yaml:"max_open_connections"`
	MaxIdleConnections int         `yaml:"max_idle_connections"`
	ConnectionLifetime int         `yaml:"connection_lifetime"`
	Logging            bool        `yaml:"logging"`
}

DatabaseConfig struct.

type HTTPClientConfig

type HTTPClientConfig struct {
	SSLVerification *bool         `yaml:"ssl_verification"`
	MockAddress     string        `yaml:"mock_address"`
	MockedDomains   []string      `yaml:"mocked_domains"`
	Timeout         time.Duration `yaml:"timeout"`
}

HTTPClientConfig struct.

func (*HTTPClientConfig) IsSSLVerificationEnabled

func (h *HTTPClientConfig) IsSSLVerificationEnabled() bool

IsSSLVerificationEnabled returns SSL verification flag (default is true).

type HTTPServerConfig

type HTTPServerConfig struct {
	Host   string `yaml:"host"`
	Listen string `yaml:"listen"`
}

HTTPServerConfig struct.

type Info

type Info struct {
	Name     string `yaml:"name"`
	Code     string `yaml:"code"`
	LogoPath string `yaml:"logo_path"`
	Secret   string `yaml:"secret"`
}

Info struct.

func (Info) GetCode

func (t Info) GetCode() string

GetCode transport code.

func (Info) GetLogoPath

func (t Info) GetLogoPath() string

GetLogoPath transport logo.

func (Info) GetName

func (t Info) GetName() string

GetName transport name.

func (Info) GetSecret

func (t Info) GetSecret() string

GetSecret returns secret.

type InfoInterface

type InfoInterface interface {
	GetName() string
	GetCode() string
	GetLogoPath() string
	GetSecret() string
}

InfoInterface transport settings data structure.

type ZabbixConfig added in v2.6.4

type ZabbixConfig struct {
	ServerHost   string `yaml:"server_host"`
	Host         string `yaml:"host"`
	ServerPort   int    `yaml:"server_port"`
	MetricPrefix string `yaml:"metric_prefix"`
	Interval     uint64 `yaml:"interval"`
}

ZabbixConfig contains information about Zabbix connection.

Jump to

Keyboard shortcuts

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