summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-10 13:37:49 +0300
committerWolfy-J <[email protected]>2018-06-10 13:37:49 +0300
commitf633e6dff42cd3fa68e801dd70e3704a47949b55 (patch)
treeaef129af6f91a8dbb5926f36d7875c1a796219f2
parent28fe20760457a31c21330d2a4ec2fec007e04d2d (diff)
merge candidates and configured
-rw-r--r--cmd/rr/cmd/root.go6
-rw-r--r--cmd/rr/cmd/serve.go8
-rw-r--r--cmd/rr/http/reload.go4
-rw-r--r--cmd/rr/http/workers.go4
-rw-r--r--cmd/rr/main.go2
5 files changed, 11 insertions, 13 deletions
diff --git a/cmd/rr/cmd/root.go b/cmd/rr/cmd/root.go
index c1e03160..ca83164e 100644
--- a/cmd/rr/cmd/root.go
+++ b/cmd/rr/cmd/root.go
@@ -37,8 +37,8 @@ var (
// Logger - shared logger.
Logger = logrus.New()
- // Services - shared service bus.
- Services = service.NewContainer(Logger)
+ // Container - shared service bus.
+ Container = service.NewContainer(Logger)
// CLI is application endpoint.
CLI = &cobra.Command{
@@ -68,7 +68,7 @@ func init() {
}
if cfg := initConfig(cfgFile, []string{"."}, ".rr"); cfg != nil {
- if err := Services.Configure(cfg); err != nil {
+ if err := Container.Configure(cfg); err != nil {
panic(err)
}
}
diff --git a/cmd/rr/cmd/serve.go b/cmd/rr/cmd/serve.go
index 17409411..ffa283d3 100644
--- a/cmd/rr/cmd/serve.go
+++ b/cmd/rr/cmd/serve.go
@@ -27,9 +27,7 @@ import (
"syscall"
)
-var (
- stopSignal = make(chan os.Signal, 1)
-)
+var stopSignal = make(chan os.Signal, 1)
func init() {
CLI.AddCommand(&cobra.Command{
@@ -42,7 +40,7 @@ func init() {
}
func serveHandler(cmd *cobra.Command, args []string) {
- Services.Serve()
+ Container.Serve()
<-stopSignal
- Services.Stop()
+ Container.Stop()
}
diff --git a/cmd/rr/http/reload.go b/cmd/rr/http/reload.go
index 23c36144..5814cc4a 100644
--- a/cmd/rr/http/reload.go
+++ b/cmd/rr/http/reload.go
@@ -36,11 +36,11 @@ func init() {
}
func reloadHandler(cmd *cobra.Command, args []string) error {
- if !rr.Services.Has("rpc") {
+ if !rr.Container.Has("rpc") {
return errors.New("RPC service is not configured")
}
- client, err := rr.Services.Get("rpc").(*rpc.Service).Client()
+ client, err := rr.Container.Get("rpc").(*rpc.Service).Client()
if err != nil {
return err
}
diff --git a/cmd/rr/http/workers.go b/cmd/rr/http/workers.go
index 61fee2a1..6d74a412 100644
--- a/cmd/rr/http/workers.go
+++ b/cmd/rr/http/workers.go
@@ -36,11 +36,11 @@ func init() {
}
func workersHandler(cmd *cobra.Command, args []string) error {
- if !rr.Services.Has("rpc") {
+ if !rr.Container.Has("rpc") {
return errors.New("RPC service is not configured")
}
- client, err := rr.Services.Get("rpc").(*rpc.Service).Client()
+ client, err := rr.Container.Get("rpc").(*rpc.Service).Client()
if err != nil {
return err
}
diff --git a/cmd/rr/main.go b/cmd/rr/main.go
index 26f70fdd..625e879c 100644
--- a/cmd/rr/main.go
+++ b/cmd/rr/main.go
@@ -32,7 +32,7 @@ import (
func main() {
// provides ability to make local connection to services
- rr.Services.Register("rpc", new(rpc.Service))
+ rr.Container.Register("rpc", new(rpc.Service))
// you can register additional commands using cmd.CLI
rr.Execute()