Documentation ¶
Index ¶
- Variables
- type CommandLine
- func (cl *CommandLine) Cleanup()
- func (cl *CommandLine) Get(key string, overrideDefault *string) (string, error)
- func (cl *CommandLine) GetArray(key string, overrideDefault *[]string) ([]string, error)
- func (cl *CommandLine) Init(args map[string]string) error
- func (cl *CommandLine) Register(key, defaultValue string, params map[string]string, t reflect.Type) error
- type Environment
- func (env *Environment) Cleanup()
- func (env *Environment) Get(key string, overrideDefault *string) (string, error)
- func (env *Environment) GetArray(key string, overrideDefault *[]string) ([]string, error)
- func (env *Environment) Init(args map[string]string) error
- func (env *Environment) Register(key, defaultValue string, params map[string]string, t reflect.Type) error
- type Source
Constants ¶
This section is empty.
Variables ¶
View Source
var Debug = false
Debug controls sources debug output
View Source
var ( // ErrKeyExists should be returned when the key has already // been registered with the source and it can't be re-registered // e.g. when using CommandLine, which uses the flag package ErrKeyExists = errors.New("Key already exists") )
View Source
var Logger func(message string, args ...interface{})
Logger is called for each log message. If nil, log.Printf will be called instead.
Functions ¶
This section is empty.
Types ¶
type CommandLine ¶
type CommandLine struct {
// contains filtered or unexported fields
}
CommandLine implements command line configuration using the flag package
func (*CommandLine) Cleanup ¶
func (cl *CommandLine) Cleanup()
Cleanup is called at the end of parsing
func (*CommandLine) Get ¶
func (cl *CommandLine) Get(key string, overrideDefault *string) (string, error)
Get is called to retrieve a key value
func (*CommandLine) GetArray ¶
func (cl *CommandLine) GetArray(key string, overrideDefault *[]string) ([]string, error)
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
Environment implements environment variable configuration using envconf
func (*Environment) Cleanup ¶
func (env *Environment) Cleanup()
Cleanup is called at the end of parsing
func (*Environment) Get ¶
func (env *Environment) Get(key string, overrideDefault *string) (string, error)
Get is called to retrieve a key value
func (*Environment) GetArray ¶
func (env *Environment) GetArray(key string, overrideDefault *[]string) ([]string, error)
GetArray is called to retrieve an array value
type Source ¶
type Source interface { // Init is called at the start of a new struct Init(args map[string]string) error // Cleanup is called at the end of parsing Cleanup() // Register is called to register each struct field Register(key, defaultValue string, params map[string]string, t reflect.Type) error // Get is called to retrieve a key value // - FIXME could use interface{} and maintain types, e.g. json? Get(key string, overrideDefault *string) (string, error) // GetArray is called to retrieve an array value GetArray(key string, overrideDefault *[]string) ([]string, error) }
Source should be implemented by Gofigure sources, e.g. environment, command line, file, http etc
Click to show internal directories.
Click to hide internal directories.