config

package
v0.0.0-...-6e4230c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2016 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFirst

func AddFirst(cc cfg.Configurer)

AddFirst registers configuration source and adds it to the beginning of configuration sources list, setting min priority

func AddLast

func AddLast(cc cfg.Configurer)

AddLast registers configuration source and adds it to the end of configuration sources list, setting max priority

func Alias

func Alias(virtual, real string)

Alias method registers configuration key alias

func AutoFind

func AutoFind(name, subfolderName string) error

AutoFind registers configuration source read from required file File will searched in current folder, then in home folder and then in /etc/ File type will be determined from its extension

func CustomMap

func CustomMap(src map[string]interface{})

CustomMap methods registers custom configuration source from provided map

func EnableCustomFlags

func EnableCustomFlags(f *goflag.FlagSet)

EnableCustomFlags registers configuration source from provided FlagSet

func EnableCustomPFlags

func EnableCustomPFlags(f *gopflag.FlagSet)

EnableCustomPFlags registers configuration source from provided improved PFlagSet

func EnableFlags

func EnableFlags()

EnableFlags enables standard library flags reading

func EnablePFlags

func EnablePFlags()

EnablePFlags enables improved flags reading

func EnablePlaceholdersInFile

func EnablePlaceholdersInFile()

EnablePlaceholdersInFile enables placeholders parsing

func EnableValidation

func EnableValidation()

EnableValidation enables config values validation

func Has

func Has(key string) bool

Has returns true if configurer has requested field

func INIAutoFind

func INIAutoFind(filename, subfolderName string)

INIAutoFind registers configuration source read from required file File will searched in current folder, then in home folder and then in /etc/

func INIFile

func INIFile(names ...string)

INIFile registers configuration source read from JSON file

func JSONAutoFind

func JSONAutoFind(filename, subfolderName string)

JSONAutoFind registers configuration source read from required file File will searched in current folder, then in home folder and then in /etc/

func JSONFile

func JSONFile(names ...string)

JSONFile registers configuration source read from JSON file

func KeyFunc

func KeyFunc(key string) func(interface{}) error

KeyFunc return Unmarshaling function for requested key

func MustValidate

func MustValidate()

MustValidate validates config and panics on error

func OrDefault

func OrDefault(c cfg.Configurer) cfg.Configurer

OrDefault methods checks argument and returns default global configurer if provided one is null

func TOMLAutoFind

func TOMLAutoFind(filename, subfolderName string)

TOMLAutoFind registers configuration source read from required file File will searched in current folder, then in home folder and then in /etc/

func TOMLFile

func TOMLFile(names ...string)

TOMLFile registers configuration source read from TOML file

func UnmarshalKey

func UnmarshalKey(key string, target interface{}) error

UnmarshalKey writes configuration value from string key into interface target

func Validate

func Validate() error

Validate performs config validation

func YAMLAutoFind

func YAMLAutoFind(filename, subfolderName string)

YAMLAutoFind registers configuration source read from required file File will searched in current folder, then in home folder and then in /etc/

func YAMLFile

func YAMLFile(names ...string)

YAMLFile registers configuration source read from YAML file

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config is helper configuration structure

func New

func New() *Config

New creates new Config instance

func (*Config) AddFirst

func (c *Config) AddFirst(cc cfg.Configurer)

AddFirst registers configuration source and adds it to the beginning of configuration sources list, setting min priority

func (*Config) AddLast

func (c *Config) AddLast(cc cfg.Configurer)

AddLast registers configuration source and adds it to the end of configuration sources list, setting max priority

func (*Config) Alias

func (c *Config) Alias(virtual, real string)

Alias method registers configuration key alias

func (*Config) AutoFind

func (c *Config) AutoFind(name, subfolderName string) error

AutoFind registers configuration source read from required file File will searched in current folder, then in home folder and then in /etc/ File type will be determined from its extension

func (*Config) CustomMap

func (c *Config) CustomMap(src map[string]interface{})

CustomMap methods registers custom configuration source from provided map

func (*Config) EnableCustomFlags

func (c *Config) EnableCustomFlags(f *goflag.FlagSet)

EnableCustomFlags registers configuration source from provided FlagSet

func (*Config) EnableCustomPFlags

func (c *Config) EnableCustomPFlags(f *gopflag.FlagSet)

EnableCustomPFlags registers configuration source from provided improved PFlagSet

func (*Config) EnableFlags

func (c *Config) EnableFlags()

EnableFlags enables standard library flags reading

func (*Config) EnablePFlags

func (c *Config) EnablePFlags()

EnablePFlags enables improved flags reading

func (*Config) EnablePlaceholdersInFile

func (c *Config) EnablePlaceholdersInFile()

EnablePlaceholdersInFile enables placeholders parsing

func (*Config) EnableValidation

func (c *Config) EnableValidation()

EnableValidation enables config values validation

func (*Config) Has

func (c *Config) Has(key string) bool

Has returns true if configurer has requested field

func (*Config) INIAutoFind

func (c *Config) INIAutoFind(filename, subfolderName string)

INIAutoFind registers configuration source read from required file File will searched in current folder, then in home folder and then in /etc/

func (*Config) INIFile

func (c *Config) INIFile(names ...string)

INIFile registers configuration source read from JSON file

func (*Config) JSONAutoFind

func (c *Config) JSONAutoFind(filename, subfolderName string)

JSONAutoFind registers configuration source read from required file File will searched in current folder, then in home folder and then in /etc/

func (*Config) JSONFile

func (c *Config) JSONFile(names ...string)

JSONFile registers configuration source read from JSON file

func (*Config) KeyFunc

func (c *Config) KeyFunc(key string) func(interface{}) error

KeyFunc return Unmarshaling function for requested key

func (*Config) MustValidate

func (c *Config) MustValidate()

MustValidate validates config and panics on error

func (*Config) TOMLAutoFind

func (c *Config) TOMLAutoFind(filename, subfolderName string)

TOMLAutoFind registers configuration source read from required file File will searched in current folder, then in home folder and then in /etc/

func (*Config) TOMLFile

func (c *Config) TOMLFile(names ...string)

TOMLFile registers configuration source read from TOML file

func (*Config) UnmarshalKey

func (c *Config) UnmarshalKey(key string, target interface{}) error

UnmarshalKey writes configuration value from string key into interface target

func (*Config) Validate

func (c *Config) Validate() error

Validate performs config validation

func (*Config) YAMLAutoFind

func (c *Config) YAMLAutoFind(filename, subfolderName string)

YAMLAutoFind registers configuration source read from required file File will searched in current folder, then in home folder and then in /etc/

func (*Config) YAMLFile

func (c *Config) YAMLFile(names ...string)

YAMLFile registers configuration source read from YAML file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL