Documentation ¶
Overview ¶
Package config provides types and functions to collect, validate and apply user-provided settings.
Package config provides types and functions to collect, validate and apply user-provided settings.
Index ¶
- Constants
- func Branding() string
- func MyBinaryName() string
- func Version() string
- type Config
- func (c Config) ConfigFile() string
- func (c Config) ConfigServerReadTimeout() time.Duration
- func (c Config) ConfigServerURL() string
- func (c Config) LogFormat() string
- func (c Config) LogLevel() string
- func (c Config) PortConnectTimeout() time.Duration
- func (c Config) ShowVersion() bool
- func (c Config) String() string
- func (c Config) UserNodePorts() []int
- 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 ( // 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
const ( TCPReservedPort int = 0 TCPSystemPortStart int = 1 TCPSystemPortEnd int = 1023 TCPUserPortStart int = 1024 TCPUserPortEnd int = 49151 TCPDynamicPrivatePortStart int = 49152 TCPDynamicPrivatePortEnd int = 65535 )
TCP port ranges http://www.iana.org/assignments/port-numbers Port numbers are assigned in various ways, based on three ranges: System Ports (0-1023), User Ports (1024-49151), and the Dynamic and/or Private Ports (49152-65535)
Variables ¶
This section is empty.
Functions ¶
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. The majority of values held by this object are intended to be retrieved via "Getter" methods.
func NewConfig ¶
NewConfig is a factory function that produces a new Config object based on user provided flag and config file values.
func (Config) ConfigFile ¶
ConfigFile returns the user-provided path to the on-disk LOCKSS configuration/property XML file or the default value if not provided.
func (Config) ConfigServerReadTimeout ¶
ConfigServerReadTimeout returns the user-provided choice of what timeout value to use for attempts to read the remote LOCKSS configuration file. If not set, returns the default value for our application.
func (Config) ConfigServerURL ¶
ConfigServerURL returns the user-provided URL to the LOCKSS configuration/property XML file or the default value if not provided.
func (Config) LogFormat ¶
LogFormat returns the user-provided logging format or default log format if not provided. CLI flag values take precedence if provided.
func (Config) LogLevel ¶
LogLevel returns the user-provided logging level or default log level if not provided. CLI flag values take precedence if provided.
func (Config) PortConnectTimeout ¶
PortConnectTimeout returns the user-provided choice of what timeout value to use for port connection attempts queries. If not set, returns the default value for our application.
func (Config) ShowVersion ¶
ShowVersion returns the user-provided choice of displaying the application version and exiting or the default value for this choice.
func (Config) UserNodePorts ¶
UserNodePorts returns the user-provided LOCKSS node ports to check or an empty slice if no ports were specified.