summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-11 11:20:03 +0300
committerWolfy-J <[email protected]>2018-06-11 11:20:03 +0300
commit6efaa0aa951240c2bb643761f103ee3f0fafb4d9 (patch)
tree962a39dede696c3e8d9f6cb6f6fdac88c6ef03d5 /cmd
parent7cc6d00a1c350eb3147ede00802d312d4be94dee (diff)
moving stuff around
Diffstat (limited to 'cmd')
-rw-r--r--cmd/rr/.rr.yaml8
-rw-r--r--cmd/rr/cmd/root.go2
-rw-r--r--cmd/rr/debug/listener.go2
-rw-r--r--cmd/rr/http/reset.go2
-rw-r--r--cmd/rr/http/workers.go2
-rw-r--r--cmd/rr/utils/cprint.go32
6 files changed, 40 insertions, 8 deletions
diff --git a/cmd/rr/.rr.yaml b/cmd/rr/.rr.yaml
index 29888f69..fd54d03e 100644
--- a/cmd/rr/.rr.yaml
+++ b/cmd/rr/.rr.yaml
@@ -12,7 +12,7 @@ http:
enable: true
# http host to listen.
- address: 0.0.0.0:8080
+ address: :8081
# max POST request size, including file uploads. (default: 1GB)
maxRequest: 1073741824
@@ -25,7 +25,7 @@ http:
# http worker pool configuration.
workers:
# php worker command.
- command: "php c:/GoProj/phpapp/webroot/index.php rr pipes --no-ansi"
+ command: "php /Users/wolfy-j/Projects/phpapp/webroot/index.php rr pipes --no-ansi"
# connection method (pipes, tcp://:9000, unix://socket.unix).
relay: "pipes"
@@ -33,7 +33,7 @@ http:
# worker pool configuration.
pool:
# number of workers to be serving.
- numWorkers: 16
+ numWorkers: 4
# maximum jobs per worker, 0 - unlimited.
maxJobs: 0
@@ -50,7 +50,7 @@ static:
enable: true
# root directory for static file (http would not serve .php and .htaccess files).
- dir: "c:/GoProj/phpapp/webroot"
+ dir: "/Users/wolfy-j/Projects/phpapp/webroot"
# list of extensions for forbid for serving.
forbid: [".php", ".htaccess"] \ No newline at end of file
diff --git a/cmd/rr/cmd/root.go b/cmd/rr/cmd/root.go
index 59a43b4e..e31eb332 100644
--- a/cmd/rr/cmd/root.go
+++ b/cmd/rr/cmd/root.go
@@ -25,7 +25,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/spiral/roadrunner/service"
- "github.com/spiral/roadrunner/utils"
+ "github.com/spiral/roadrunner/cmd/rr/utils"
"os"
)
diff --git a/cmd/rr/debug/listener.go b/cmd/rr/debug/listener.go
index fd3b95d3..5c9fb559 100644
--- a/cmd/rr/debug/listener.go
+++ b/cmd/rr/debug/listener.go
@@ -3,7 +3,7 @@ package debug
import (
"github.com/sirupsen/logrus"
"github.com/spiral/roadrunner/http"
- "github.com/spiral/roadrunner/utils"
+ "github.com/spiral/roadrunner/cmd/rr/utils"
"github.com/spiral/roadrunner"
)
diff --git a/cmd/rr/http/reset.go b/cmd/rr/http/reset.go
index fd27149d..2583f8cd 100644
--- a/cmd/rr/http/reset.go
+++ b/cmd/rr/http/reset.go
@@ -26,7 +26,7 @@ import (
rr "github.com/spiral/roadrunner/cmd/rr/cmd"
"github.com/spiral/roadrunner/rpc"
"github.com/spiral/roadrunner/service"
- "github.com/spiral/roadrunner/utils"
+ "github.com/spiral/roadrunner/cmd/rr/utils"
)
func init() {
diff --git a/cmd/rr/http/workers.go b/cmd/rr/http/workers.go
index 3868d748..43b78d11 100644
--- a/cmd/rr/http/workers.go
+++ b/cmd/rr/http/workers.go
@@ -31,7 +31,7 @@ import (
"github.com/spiral/roadrunner/http"
rrpc "github.com/spiral/roadrunner/rpc"
"github.com/spiral/roadrunner/service"
- "github.com/spiral/roadrunner/utils"
+ "github.com/spiral/roadrunner/cmd/rr/utils"
"net/rpc"
"os"
"strconv"
diff --git a/cmd/rr/utils/cprint.go b/cmd/rr/utils/cprint.go
new file mode 100644
index 00000000..f6f828f8
--- /dev/null
+++ b/cmd/rr/utils/cprint.go
@@ -0,0 +1,32 @@
+package utils
+
+import (
+ "fmt"
+ "gopkg.in/AlecAivazis/survey.v1/core"
+ "regexp"
+ "strings"
+)
+
+// Printf works identically to fmt.Print but adds `<white+hb>color formatting support for CLI</reset>`.
+func Printf(format string, args ...interface{}) {
+ fmt.Print(Sprintf(format, args...))
+}
+
+// Sprintf works identically to fmt.Sprintf but adds `<white+hb>color formatting support for CLI</reset>`.
+func Sprintf(format string, args ...interface{}) string {
+ r, err := regexp.Compile(`<([^>]+)>`)
+ if err != nil {
+ panic(err)
+ }
+
+ format = r.ReplaceAllStringFunc(format, func(s string) string {
+ return fmt.Sprintf(`{{color "%s"}}`, strings.Trim(s, "<>/"))
+ })
+
+ out, err := core.RunTemplate(fmt.Sprintf(format, args...), nil)
+ if err != nil {
+ panic(err)
+ }
+
+ return out
+}