Documentation ¶
Overview ¶
This is a duplicate of config/config.go without a dependency on dd-go/util to avoid pulling in the world.
Index ¶
- Constants
- func IsBlacklisted(cmdline []string, blacklist []*regexp.Regexp) bool
- func NewLoggerLevel(logLevel string) error
- func ReplaceLogger(cfg *LoggerConfig) error
- func Set(config *ini.File)
- type AgentConfig
- type CheckTimers
- type File
- func (c *File) Get(section, name string) (string, error)
- func (c *File) GetBool(section, name string, defaultVal bool) bool
- func (c *File) GetDefault(section, name string, defaultVal string) string
- func (c *File) GetDuration(section, name string, unit time.Duration) (time.Duration, error)
- func (c *File) GetDurationDefault(section, name string, unit, defaultVal time.Duration) time.Duration
- func (c *File) GetFloat(section, name string) (float64, error)
- func (c *File) GetInt(section, name string) (int, error)
- func (c *File) GetIntDefault(section, name string, defaultVal int) int
- func (c *File) GetSection(key string) (*ini.Section, error)
- func (c *File) GetStrArray(section, name, sep string) ([]string, error)
- func (c *File) GetStrArrayDefault(section, name, sep string, defaultVal []string) []string
- type LoggerConfig
Constants ¶
const ( DefaultLogLevel = "info" DefaultSyslogHost = "localhost:514" DefaultSyslogLevel = "error" )
Variables ¶
This section is empty.
Functions ¶
func IsBlacklisted ¶
IsBlacklisted returns a boolean indicating if the given command is blacklisted by our config.
func NewLoggerLevel ¶ added in v0.99.32
func ReplaceLogger ¶ added in v0.99.32
func ReplaceLogger(cfg *LoggerConfig) error
Types ¶
type AgentConfig ¶
type AgentConfig struct { Enabled bool APIKey string HostName string APIEndpoint *url.URL LogLevel string QueueSize int Blacklist []*regexp.Regexp MaxProcFDs int ProcLimit int AllowRealTime bool Proxy *url.URL Timers *CheckTimers Logger *LoggerConfig // Kubernetes CollectKubernetesMetadata bool KubernetesKubeletHost string KubernetesHTTPKubeletPort int KubernetesHTTPSKubeletPort int }
func NewAgentConfig ¶
func NewAgentConfig(agentConf, legacyConf *File) (*AgentConfig, error)
NewAgentConfig returns an AgentConfig using a conf and legacy configuration. conf will be nil if there is no configuration available but legacyConf will give an error if nil.
func NewDefaultAgentConfig ¶
func NewDefaultAgentConfig() *AgentConfig
NewDefaultAgentConfig returns an AgentConfig with defaults initialized
type CheckTimers ¶
type File ¶
type File struct { Path string // contains filtered or unexported fields }
A File is a representation of an ini file with some custom convenience methods.
func Get ¶
func Get() *File
Get returns the currently active global config (the previous config opened via NewFile)
func New ¶
New reads the file in configPath and returns a corresponding *File or an error if encountered. This File is set as the default active config file.
func NewIfExists ¶
NewIfExists works as New, but does not return an error if the file does not exist. Instead, it returns a null File pointer.
func (*File) Get ¶
Get returns a value from the section/name pair, or an error if it can't be found.
func (*File) GetBool ¶
GetBool returns a truthy config value. It accepts 1, t, T, TRUE, true, True, YES, yes, Yes, y, ON, on, On, 0, f, F, FALSE, false, False, NO, no, No, n, OFF, off, Off. Any other value returns an error.
func (*File) GetDefault ¶
GetDefault attempts to get the value in section/name, but returns the default if one is not found.
func (*File) GetDuration ¶
GetDuration returns a value from section/name converted to a duration using unit.
func (*File) GetDurationDefault ¶
func (c *File) GetDurationDefault(section, name string, unit, defaultVal time.Duration) time.Duration
GetDuration returns a value from section/name converted to a duration using unit and returns the default if any error occurs.
func (*File) GetFloat ¶
GetFloat gets an float value from section/name, or an error if it is missing or cannot be converted to an float.
func (*File) GetInt ¶
GetInt gets an integer value from section/name, or an error if it is missing or cannot be converted to an integer.
func (*File) GetIntDefault ¶
GetIntDefault gets an integer value from section/name, but returns the default if one is not found.
func (*File) GetSection ¶
GetSection is a convenience method to return an entire section of ini config
func (*File) GetStrArray ¶
GetStrArray returns the value split across `sep` into an array of strings.
type LoggerConfig ¶ added in v0.99.32
type LoggerConfig struct { AppName string LogLevel string Console bool Syslog bool SyslogLevel string SyslogHost string Filename string }
LoggerConfig defines the configuration of a logger
func (*LoggerConfig) SeelogConfig ¶ added in v0.99.32
func (cfg *LoggerConfig) SeelogConfig() (*seelogConfig, error)
func (*LoggerConfig) SeelogLogger ¶ added in v0.99.32
func (cfg *LoggerConfig) SeelogLogger() (log.LoggerInterface, error)
SeelogLogger returns a new seelog Logger