summaryrefslogtreecommitdiff
path: root/cmd/rr
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-03 12:58:52 +0300
committerWolfy-J <[email protected]>2018-06-03 12:58:52 +0300
commit89b1e86b6e3fbb099ba6bd34ac0501f752b4514c (patch)
tree16bce58e73970caf8f991da009f9b4af86497842 /cmd/rr
parent0e2fc4b5e21d115850ece2bd44f21fc5b335c41d (diff)
simplier stuff
Diffstat (limited to 'cmd/rr')
-rw-r--r--cmd/rr/cmd/root.go5
-rw-r--r--cmd/rr/http/register.go10
-rw-r--r--cmd/rr/main.go9
3 files changed, 13 insertions, 11 deletions
diff --git a/cmd/rr/cmd/root.go b/cmd/rr/cmd/root.go
index ac8466ef..a9f27e9d 100644
--- a/cmd/rr/cmd/root.go
+++ b/cmd/rr/cmd/root.go
@@ -33,7 +33,7 @@ import (
// Service bus for all the commands.
var (
// Shared service bus.
- Bus *service.Bus
+ Bus = service.NewBus()
// Root is application endpoint.
Root = &cobra.Command{
@@ -47,8 +47,7 @@ var (
// Execute adds all child commands to the Root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the Root.
-func Execute(serviceBus *service.Bus) {
- Bus = serviceBus
+func Execute() {
if err := Root.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
diff --git a/cmd/rr/http/register.go b/cmd/rr/http/register.go
new file mode 100644
index 00000000..a670427c
--- /dev/null
+++ b/cmd/rr/http/register.go
@@ -0,0 +1,10 @@
+package http
+
+import (
+ rr "github.com/spiral/roadrunner/cmd/rr/cmd"
+ "github.com/spiral/roadrunner/http"
+)
+
+func init() {
+ rr.Bus.Register(&http.Service{})
+}
diff --git a/cmd/rr/main.go b/cmd/rr/main.go
index fe3de1c4..4d132da6 100644
--- a/cmd/rr/main.go
+++ b/cmd/rr/main.go
@@ -24,19 +24,12 @@ package main
import (
"github.com/spiral/roadrunner/cmd/rr/cmd"
- "github.com/spiral/roadrunner/service"
- "github.com/spiral/roadrunner/http"
// service plugins
_ "github.com/spiral/roadrunner/cmd/rr/http"
)
-var bus = service.NewBus()
-
func main() {
- // http server with PSR7 support
- bus.Register(&http.Service{})
-
// you can register additional commands using cmd.Root
- cmd.Execute(bus)
+ cmd.Execute()
}