diff options
author | Wolfy-J <[email protected]> | 2018-06-03 12:54:43 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-03 12:54:43 +0300 |
commit | 36ea77baa5a41de10bd604cd0e5b5b3cafaaeb64 (patch) | |
tree | 13ca8abd454a6668f490eec2e44b1520bd3953fe /cmd/rr/utils/config.go | |
parent | b02611b7266589d888e054a1d2e4432ae370617d (diff) |
service bus, http service, rpc bus, cli commands, new configs
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) +} |