Documentation ¶
Overview ¶
Package config provides types and functions to collect, validate and apply user-provided settings.
Index ¶
- Constants
- func Branding()
- func PathExists(path string) bool
- type Config
- func (c Config) IgnoreDNSErrors() bool
- func (c *Config) ImportConfigFile(fh io.Reader) (bool, error)
- func (c Config) LogFormat() string
- func (c Config) LogLevel() string
- func (c Config) Query() string
- func (c Config) QueryTypes() []string
- func (c Config) Servers() []string
- func (c Config) ShowVersion() bool
- func (c Config) String() string
- func (c Config) Validate() error
Constants ¶
const ( // LogLevelFatal is used for errors that should definitely be noted. // Commonly used for hooks to send errors to an error tracking service. LogLevelFatal string = "fatal" // LogLevelError is for errors that should definitely be noted. LogLevelError string = "error" // LogLevelWarn is for non-critical entries that deserve eyes. LogLevelWarn string = "warn" // LogLevelInfo is for general application operational entries. LogLevelInfo string = "info" // LogLevelDebug is for debug-level messages and is usually enabled // when debugging. Very verbose logging. LogLevelDebug string = "debug" )
Log levels
const ( RequestTypeA string = "A" RequestTypeAAAA string = "AAAA" RequestTypeCNAME string = "CNAME" RequestTypeMX string = "MX" )
Supported Request types
const ( // LogFormatCLI provides human-friendly CLI output LogFormatCLI string = "cli" // LogFormatJSON provides JSON output LogFormatJSON string = "json" // LogFormatLogFmt provides logfmt plain-text output LogFormatLogFmt string = "logfmt" // LogFormatText provides human-friendly colored output LogFormatText string = "text" // LogFormatDiscard discards all logs LogFormatDiscard string = "discard" )
apex/log Handlers
--------------------------------------------------------- cli - human-friendly CLI output discard - discards all logs es - Elasticsearch handler graylog - Graylog handler json - JSON output handler kinesis - AWS Kinesis handler level - level filter handler logfmt - logfmt plain-text formatter memory - in-memory handler for tests multi - fan-out to multiple handlers papertrail - Papertrail handler text - human-friendly colored output delta - outputs the delta between log calls and spinner
Variables ¶
This section is empty.
Functions ¶
func Branding ¶
func Branding()
Branding is responsible for emitting application name, version and origin
func PathExists ¶
PathExists confirms that the specified path exists
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is a unified set of configuration values for this application. This struct is configured via command-line flags or TOML configuration file provided by the user. The majority of values held by this object are intended to be retrieved via "Getter" methods.
func NewBaseConfig ¶
func NewBaseConfig() Config
NewBaseConfig returns a bare-minimum initialized config object for further customization before returning to a caller
func NewConfig ¶
NewConfig is a factory function that produces a new Config object based on user provided flag and config file values.
func (Config) IgnoreDNSErrors ¶
IgnoreDNSErrors returns the user-provided choice of ignoring DNS-related errors or the default value for this choice.
func (*Config) ImportConfigFile ¶
ImportConfigFile reads from an io.Reader and unmarshals a configuration file in TOML format into the associated Config struct.
func (Config) LogFormat ¶
LogFormat returns the user-provided logging format or empty string if not provided. CLI flag values take precedence if provided.
func (Config) LogLevel ¶
LogLevel returns the user-provided logging level or empty string if not provided. CLI flag values take precedence if provided.
func (Config) Query ¶
Query returns the user-provided DNS server query or empty string if DNS server query was not provided. CLI flag values take precedence if provided.
func (Config) QueryTypes ¶
QueryTypes returns the user-provided choice of which DNS record types to request when submitting queries. If not set, defaults to A record type.
func (Config) Servers ¶
Servers returns a slice of configured DNS server entries or nil if DNS server entries were not provided. CLI flag values take precedence if provided.
func (Config) ShowVersion ¶
ShowVersion returns the user-provided choice of displaying the application version and exiting or the default value for this choice.