Documentation
¶
Index ¶
- type Applier
- type Chan
- type Config
- type Logger
- type Manager
- func (m *Manager) AddAppliers(name interface{}, appliers ...Applier)
- func (m *Manager) AddValidators(name interface{}, validators ...Validator)
- func (m *Manager) GetConfig(name interface{}) Config
- func (m *Manager) GetWatcher(name interface{}) *watcher
- func (m *Manager) MakeConfig(ctx context.Context, name interface{}, config Config) error
- func (m *Manager) NewConfigChan(name interface{}) Chan
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chan ¶
type Chan chan Config
Chan is a channel within which pointers to a new configuration will be sent.
type Config ¶
type Config interface { // DeepCopyConfig returns a copy of the current struct. DeepCopyConfig() Config // ConfigFile returns the path of the config file. ConfigFile() string }
Config is an interface describing functions needed by this module.
type Logger ¶
type Logger interface { Tracef(string, ...interface{}) Debugf(string, ...interface{}) Infof(string, ...interface{}) Warnf(string, ...interface{}) Errorf(string, ...interface{}) Fatalf(string, ...interface{}) }
Logger is the interface that describes the logger used by this module. You can wrap any logger lib that you alreadey use in a struct that comply with this interface if your logger does not already implement this interface. For instance github.com/sirupsen/logrus is already compliant with this interface. You can lookup for testLogger in config_test.go to see an example of wrapping.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is a struct that stores configuration watchers and the chans used to broadcasts new configurations when configurations files are updated.
func GetManager ¶
GetManager returns the Manager that will give you access to all your configs.
func (*Manager) AddAppliers ¶
AddAppliers ...
func (*Manager) AddValidators ¶
AddValidators ...
func (*Manager) GetWatcher ¶
func (m *Manager) GetWatcher(name interface{}) *watcher
GetWatcher returns an existing configuration, nil otherwise.
func (*Manager) MakeConfig ¶
MakeConfig creates a named configuration. If config.ConfigFile() returns anything but an empty string it will spawn a goroutine which will watch for changes in the file. The file does not have to exists, it can be created after the config has been created.
func (*Manager) NewConfigChan ¶
NewConfigChan returns a channel that will be used to send new configurations when the configuration file associated to the Config has been updated.