Documentation ¶
Overview ¶
Package config provides config structures, and a mechanism that merges sources such that the global config file, a project local config file and command line flags.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Edit ¶
func Edit() error
Edit opens the project local config file with an editor. If the local config file is missing, Edit creates a new local config file. $EDITOR is used as an editor if it is configured. Else, Vim is used.
func EditGlobal ¶ added in v0.8.0
func EditGlobal() error
EditGlobal is the same as Edit, but edit the global config.
Types ¶
type Config ¶
type Config struct { Default *Default `toml:"default"` Meta *Meta `toml:"meta"` REPL *REPL `toml:"repl"` Server *Server `toml:"server"` Log *Log `toml:"log"` Request *Request `toml:"request"` }
Each TOML key must be equal the field name in the lower-case. It is a limitation of spf13/viper.
func Get ¶
Get returns the config which loaded from the global and local config files, and command line flags passed as an argument. Note that fs must have been parsed.
The order of priority is flags > local > global.
type REPL ¶
type REPL struct { PromptFormat string `toml:"promptFormat"` InputPromptFormat string `toml:"inputPromptFormat"` ColoredOutput bool `toml:"coloredOutput"` Silent bool `toml:"silent"` SplashTextPath string `toml:"splashTextPath"` // TODO: Split history files between projects. HistorySize int `toml:"historySize"` }
type ValidationError ¶ added in v0.8.0
type ValidationError struct {
Err *multierror.Error
}
ValidationError contains errors that describes invalid config conditions.
func (*ValidationError) Error ¶ added in v0.8.0
func (e *ValidationError) Error() string
Error returns ValidationError's error text.