Documentation ¶
Overview ¶
Package config handles config files, -config, and env vars at startup.
Index ¶
Constants ¶
View Source
const ( DEFAULT_ADDR = "http://127.0.0.1:32084" DEFAULT_CONFIG_FILES = "/etc/etre/es.yaml,~/.es.yaml" DEFAULT_IFS = "," DEFAULT_QUERY_TIMEOUT = "5s" DEFAULT_TIMEOUT = "10s" DEFAULT_RETRY = 0 DEFAULT_RETRY_WAIT = "1s" )
Variables ¶
View Source
var (
ErrUnknownRequest = errors.New("request does not exist")
)
Functions ¶
func DefaultTrace ¶
func DefaultTrace() string
Types ¶
type CommandLine ¶
CommandLine represents options (--addr, etc.) and args: entity type, return labels, and query predicates. The caller is expected to copy and use the embedded structs separately, like:
var o config.Options = cmdLine.Options for i, arg := range cmdline.Args {
func ParseCommandLine ¶
func ParseCommandLine(def Options) CommandLine
ParseCommandLine parses the command line and env vars. Command line options override env vars. Default options are used unless overridden by env vars or command line options. Defaults are usually parsed from config files.
type Options ¶
type Options struct { Addr string `arg:"env:ES_ADDR" yaml:"addr"` Config string `arg:"env:ES_CONFIG"` Debug bool `arg:"env:ES_DEBUG" yaml:"debug"` Delete bool DeleteLabel bool `arg:"--delete-label"` Env string `arg:"env:ES_ENV" yaml:"env"` Help bool JSON bool `arg:"env:ES_JSON" yaml:"json"` IFS string `arg:"env" yaml:"ifs"` Labels bool `arg:"env:ES_LABELS" yaml:"labels"` Old bool `arg:"env:ES_OLD" yaml:"old"` QueryTimeout string `arg:"--query-timeout,env:ES_QUERY_TIMEOUT" yaml:"query_timeout"` Retry uint `arg:"env:ES_RETRY" yaml:"retry"` RetryWait string `arg:"--retry-wait,env:ES_RETRY_WAIT" yaml:"retry_wait"` SetOp string `arg:"--set-op,env:ES_SET_OP"` SetId string `arg:"--set-id,env:ES_SET_ID"` SetSize int `arg:"--set-size,env:ES_SET_SIZE"` Strict bool `arg:"env:ES_STRICT" yaml:"strict"` Timeout string `arg:"env:ES_TIMEOUT" yaml:"timeout"` Trace string `arg:"env:ES_TRACE" yaml:"trace"` Update bool Unique bool `arg:"-u"` Version bool `arg:"-v"` Watch bool }
Options represents typical command line options: --addr, --config, etc.
func ParseConfigFiles ¶
Click to show internal directories.
Click to hide internal directories.