Documentation
¶
Overview ¶
Package config provides types and functions to collect, validate and apply user-provided settings.
Index ¶
Constants ¶
View Source
const ( // LogLevelDisabled maps to zerolog.Disabled logging level LogLevelDisabled string = "disabled" // LogLevelPanic maps to zerolog.PanicLevel logging level LogLevelPanic string = "panic" // LogLevelFatal maps to zerolog.FatalLevel logging level LogLevelFatal string = "fatal" // LogLevelError maps to zerolog.ErrorLevel logging level LogLevelError string = "error" // LogLevelWarn maps to zerolog.WarnLevel logging level LogLevelWarn string = "warn" // LogLevelInfo maps to zerolog.InfoLevel logging level LogLevelInfo string = "info" // LogLevelDebug maps to zerolog.DebugLevel logging level LogLevelDebug string = "debug" // LogLevelTrace maps to zerolog.TraceLevel logging level LogLevelTrace string = "trace" )
Variables ¶
View Source
var ErrVersionRequested = errors.New("version information requested")
ErrVersionRequested indicates that the user requested application version information.
View Source
var Usage = func() { flag.CommandLine.SetOutput(os.Stdout) _, _ = fmt.Fprintln(flag.CommandLine.Output(), "\n"+Version()+"\n") _, _ = fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0]) flag.PrintDefaults() }
Usage is a custom override for the default Help text provided by the flag package. Here we prepend some additional metadata to the existing output.
Functions ¶
Types ¶
type Config ¶
type Config struct { // Log is an embedded zerolog Logger initialized via config.New(). Log zerolog.Logger // Domain is the name of the domain whose WHOIS records will be evaluated. Domain string // RegistrarServer is the optional user-specified server to use for WHOIS // lookups. RegistrarServer string // LoggingLevel is the supported logging level for this application. LoggingLevel string // AgeWarning is the number of days remaining before domain expiration // when a WARNING state is triggered. AgeWarning int // AgeCritical is the number of days remaining before domain expiration // when a CRITICAL state is triggered. AgeCritical int // EmitBranding controls whether "generated by" text is included at the // bottom of application output. This output is included in the Nagios // dashboard and notifications. This output may not mix well with branding // output from other tools such as atc0005/send2teams which also insert // their own branding output. EmitBranding bool // DisableReferralLookups controls whether WHOIS server referral lookups // should be disabled. DisableReferralLookups bool // ShowVersion is a flag indicating whether the user opted to display only // the version string and then immediately exit the application. ShowVersion bool }
Config represents the application configuration as specified via command-line flags.
Click to show internal directories.
Click to hide internal directories.