summaryrefslogtreecommitdiff
path: root/cmd/rr/utils
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-05 16:23:14 +0300
committerWolfy-J <[email protected]>2018-06-05 16:23:14 +0300
commit76ff8d1c95e087749d559ee5a4f8f0348feafffa (patch)
tree112630d2d2cfe41d809065034c13b1066b8e05c2 /cmd/rr/utils
parent3c86132f90ef6473b4073a8b1500d01b6114fc30 (diff)
Cs and refactoring
Diffstat (limited to 'cmd/rr/utils')
-rw-r--r--cmd/rr/utils/config.go11
-rw-r--r--cmd/rr/utils/verbose.go18
2 files changed, 7 insertions, 22 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)
}
diff --git a/cmd/rr/utils/verbose.go b/cmd/rr/utils/verbose.go
deleted file mode 100644
index 43770f34..00000000
--- a/cmd/rr/utils/verbose.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package utils
-
-//if f.Verbose {
-// rr.Observe(func(event int, ctx interface{}) {
-// switch event {
-// case roadrunner.EventPoolError:
-// logrus.Error(ctx)
-// case roadrunner.EventWorkerCreate:
-// logrus.Infof("%s - created", ctx)
-// case roadrunner.EventWorkerError:
-// logrus.Errorf("%s: %s", ctx.(roadrunner.WorkerError).Worker, ctx.(roadrunner.WorkerError).Error())
-// case roadrunner.EventWorkerDestruct:
-// logrus.Warnf("%s - destructed", ctx)
-// case roadrunner.EventWorkerKill:
-// logrus.Warnf("%s - killed", ctx)
-// }
-// })
-//}