Documentation
¶
Overview ¶
Package config handles config files, -config, and env vars at startup.
Index ¶
Constants ¶
const ( DEFAULT_CONFIG_FILES = "/etc/spinc/spinc.yaml,~/.spinc.yaml" DEFAULT_TIMEOUT = 10000 // 10s )
Variables ¶
var (
ErrUnknownRequest = errors.New("request does not exist")
)
Functions ¶
func Help ¶
func Help(full bool, rmc rm.Client)
Help prints full help or minimal request help if full is false. An rm.Client is used to get the list of available requests from the Request Manager API.
func RequestHelp ¶
Types ¶
type CommandLine ¶
CommandLine represents options (--addr, etc.) and commands (start, etc.). The caller is expected to copy and use the embedded structs separately, like:
var o config.Options = cmdLine.Options var c config.Command = cmdLine.Command
Some commands and options are mutually exclusive, like --ping and --version. Others can be used together, like --addr and --timeout with any command.
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" yaml:"addr"`
Config string `arg:"env"`
Debug bool
Env string
Help bool
Ping bool
Timeout uint `arg:"env" yaml:"timeout"`
Version bool
Verbose bool `arg:"-v"`
}
Options represents typical command line options: --addr, --config, etc.