diff options
Diffstat (limited to 'cmd/rr/utils/config.go')
-rw-r--r-- | cmd/rr/utils/config.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/cmd/rr/utils/config.go b/cmd/rr/utils/config.go new file mode 100644 index 00000000..e7e22b3a --- /dev/null +++ b/cmd/rr/utils/config.go @@ -0,0 +1,23 @@ +package utils + +import ( + "github.com/spf13/viper" + "github.com/spiral/roadrunner/service" +) + +type ConfigWrapper struct { + Viper *viper.Viper +} + +func (w *ConfigWrapper) Get(key string) service.Config { + sub := w.Viper.Sub(key) + if sub == nil { + return nil + } + + return &ConfigWrapper{sub} +} + +func (w *ConfigWrapper) Unmarshal(out interface{}) error { + return w.Viper.Unmarshal(out) +} |