summaryrefslogtreecommitdiff
path: root/cmd/rr/utils/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/rr/utils/config.go')
-rw-r--r--cmd/rr/utils/config.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/cmd/rr/utils/config.go b/cmd/rr/utils/config.go
index e7e22b3a..452dd195 100644
--- a/cmd/rr/utils/config.go
+++ b/cmd/rr/utils/config.go
@@ -5,19 +5,22 @@ import (
"github.com/spiral/roadrunner/service"
)
-type ConfigWrapper struct {
+// ViperWrapper provides interface bridge between Viper configs and service.Config.
+type ViperWrapper struct {
Viper *viper.Viper
}
-func (w *ConfigWrapper) Get(key string) service.Config {
+// Get nested config section (sub-map), returns nil if section not found.
+func (w *ViperWrapper) Get(key string) service.Config {
sub := w.Viper.Sub(key)
if sub == nil {
return nil
}
- return &ConfigWrapper{sub}
+ return &ViperWrapper{sub}
}
-func (w *ConfigWrapper) Unmarshal(out interface{}) error {
+// Unmarshal unmarshal config data into given struct.
+func (w *ViperWrapper) Unmarshal(out interface{}) error {
return w.Viper.Unmarshal(out)
}