Documentation
¶
Overview ¶
Package configuration is used to store agent and server configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Address string `env:"ADDRESS" json:"address"` FileStoragePath string `env:"FILE_STORAGE_PATH" json:"store_file"` Database string `env:"DATABASE_DSN" json:"database_dsn"` ConfigFile string `env:"CONFIG"` PrivateCryptoKey string `env:"CRYPTO_KEY" json:"crypto_key"` TrustedSubnet string `env:"TRUSTED_SUBNET" json:"trusted_subnet"` CertFilePath string `env:"CERTIFICATE" json:"certificate"` Key []byte StoreInterval int `env:"STORE_INTERVAL" json:"store_interval"` Restore bool `env:"RESTORE" json:"restore"` UseProtobuff bool `env:"USE_PROTOBUFF" json:"use_protobuff"` }
Config contains configuration for server.
func Parse ¶
Parse - return parsed config.
Environment variables have higher priority over command line variables and config file. Command line variables have higher priority over variables from config file.
func (*Config) UnmarshalJSON ¶
UnmarshalJSON - For anmarshaling of the time parameters of the configuration file.
type ConfigAgent ¶
type ConfigAgent struct { Server string `env:"ADDRESS" json:"address,omitempty"` Path string `env:"CONFIG"` PublicCryptoKey string `env:"CRYPTO_KEY" json:"crypto_key"` CertFilePath string `env:"CERTIFICATE" json:"certificate"` Key []byte PollInterval int `env:"POLL_INTERVAL" json:"poll_interval,omitempty"` ReportInterval int `env:"REPORT_INTERVAL" json:"report_interval,omitempty"` Limit int `env:"RATE_LIMIT"` UseProtobuff bool `env:"USE_PROTOBUFF" json:"use_protobuff"` }
ConfigAgent contains configuration for agent.
func ParseAgent ¶
func ParseAgent() (*ConfigAgent, error)
ParseAgent - return parsed config.
Environment variables have higher priority over command line variables and config file. Command line variables have higher priority over variables from config file.
func (*ConfigAgent) String ¶
func (c *ConfigAgent) String() string
func (*ConfigAgent) UnmarshalJSON ¶
func (c *ConfigAgent) UnmarshalJSON(data []byte) error
UnmarshalJSON - For anmarshaling of the time parameters of the configuration file.