Documentation ¶
Index ¶
- func AbsConfig(path string) string
- func LoadFiles(dir, ext string, spec conf.SectionRegistry) ([]*conf.File, error)
- func MakeOptional(reg conf.OptionRegistry) conf.OptionRegistry
- func MapToOptions(m map[string]interface{}) ([]conf.Option, error)
- func SetOption(opts conf.Options, key, val string) conf.Options
- type MultiOptionRegistry
- type MultiSectionRegistry
- type OptionalOptionRegistry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbsConfig ¶
AbsConfig ensures that path is absolute and if not, prepends the configuration directory. AbsConfig is a no-op if path is an empty string.
func LoadFiles ¶
LoadFiles loads all files in dir that have the extension ext and parses them using spec.
func MakeOptional ¶
func MakeOptional(reg conf.OptionRegistry) conf.OptionRegistry
MakeOptional makes all options form reg optional by resetting the Required field to false.
Types ¶
type MultiOptionRegistry ¶
type MultiOptionRegistry []conf.OptionRegistry
MultiOptionRegistry is a helper type to create a conf.OptionRegistry from multiple registries.
func (MultiOptionRegistry) All ¶
func (mor MultiOptionRegistry) All() []conf.OptionSpec
All merges all option specs form all option registries. Duplicate option specs are removed and the first option spec has priority.
func (MultiOptionRegistry) GetOption ¶
func (mor MultiOptionRegistry) GetOption(opt string) (conf.OptionSpec, bool)
GetOption returns the option spec for opt. The first option spec that matches wins and has priority.
func (MultiOptionRegistry) HasOption ¶
func (mor MultiOptionRegistry) HasOption(opt string) bool
type MultiSectionRegistry ¶
type MultiSectionRegistry []conf.SectionRegistry
MultiSectionRegistry is a helper type to create a conf.SectionRegistry from multiple registries.
func (MultiSectionRegistry) OptionsForSection ¶
func (msr MultiSectionRegistry) OptionsForSection(sec string) (conf.OptionRegistry, bool)
OptionsForSection implements conf.SectionRegistry.
type OptionalOptionRegistry ¶
type OptionalOptionRegistry struct {
conf.OptionRegistry
}
func (*OptionalOptionRegistry) All ¶
func (optreg *OptionalOptionRegistry) All() []conf.OptionSpec
All wraps OptionRegistry.All and marks al options as "optional".
func (*OptionalOptionRegistry) GetOption ¶
func (optreg *OptionalOptionRegistry) GetOption(opt string) (conf.OptionSpec, bool)
GetOption wraps OptionRegistry.GetOption and marks all options as "optional".