diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/rr/main.go | 14 | ||||
-rw-r--r-- | cmd/rr/utils/size.go | 28 | ||||
-rw-r--r-- | cmd/rr/utils/utils_test.go | 12 |
3 files changed, 12 insertions, 42 deletions
diff --git a/cmd/rr/main.go b/cmd/rr/main.go index 625e879c..ea16a99a 100644 --- a/cmd/rr/main.go +++ b/cmd/rr/main.go @@ -24,7 +24,11 @@ package main import ( rr "github.com/spiral/roadrunner/cmd/rr/cmd" - "github.com/spiral/roadrunner/rpc" + + // services (plugins) + "github.com/spiral/roadrunner/service/http" + "github.com/spiral/roadrunner/service/rpc" + "github.com/spiral/roadrunner/service/static" // cli plugins _ "github.com/spiral/roadrunner/cmd/rr/http" @@ -32,7 +36,13 @@ import ( func main() { // provides ability to make local connection to services - rr.Container.Register("rpc", new(rpc.Service)) + rr.Container.Register(rpc.Name, new(rpc.Service)) + + // http serving + rr.Container.Register(http.Name, new(http.Service)) + + // serving static files + rr.Container.Register(static.Name, new(static.Service)) // you can register additional commands using cmd.CLI rr.Execute() diff --git a/cmd/rr/utils/size.go b/cmd/rr/utils/size.go deleted file mode 100644 index 176cc9e1..00000000 --- a/cmd/rr/utils/size.go +++ /dev/null @@ -1,28 +0,0 @@ -package utils - -import ( - "strconv" - "strings" -) - -func ParseSize(size string) int64 { - if len(size) == 0 { - return 0 - } - - s, err := strconv.Atoi(size[:len(size)-1]) - if err != nil { - return 0 - } - - switch strings.ToLower(size[len(size)-1:]) { - case "k", "kb": - return int64(s * 1024) - case "m", "mb": - return int64(s * 1024 * 1024) - case "g", "gb": - return int64(s * 1024 * 1024 * 1024) - } - - return 0 -} diff --git a/cmd/rr/utils/utils_test.go b/cmd/rr/utils/utils_test.go deleted file mode 100644 index f67b2a10..00000000 --- a/cmd/rr/utils/utils_test.go +++ /dev/null @@ -1,12 +0,0 @@ -package utils - -import ( - "testing" - "github.com/magiconair/properties/assert" -) - -func TestUtils(t *testing.T) { - assert.Equal(t, int64(1024), ParseSize("1K")) - assert.Equal(t, int64(1024*1024), ParseSize("1M")) - assert.Equal(t, int64(2*1024*1024*1024), ParseSize("2G")) -} |