mirror of
https://github.com/spf13/viper
synced 2025-05-14 16:17:18 +00:00
20 lines
421 B
Go
20 lines
421 B
Go
|
package viper
|
||
|
|
||
|
type RegisteredConfig struct {
|
||
|
Key string
|
||
|
CanBeNil bool
|
||
|
OnUpdate func(e *Event)
|
||
|
OnUpdateFailed func(e *Event)
|
||
|
Schema *interface{}
|
||
|
Validator func(interface{}) bool
|
||
|
}
|
||
|
|
||
|
func (v *Viper) Register(r []RegisteredConfig) {
|
||
|
if v.registered == nil {
|
||
|
v.registered = make(map[string]RegisteredConfig)
|
||
|
}
|
||
|
for _, config := range r {
|
||
|
v.registered[config.Key] = config
|
||
|
}
|
||
|
}
|