summaryrefslogtreecommitdiff
path: root/input/http
diff options
context:
space:
mode:
Diffstat (limited to 'input/http')
-rw-r--r--input/http/http.go18
1 files changed, 14 insertions, 4 deletions
diff --git a/input/http/http.go b/input/http/http.go
index fcac066..87ec0f9 100644
--- a/input/http/http.go
+++ b/input/http/http.go
@@ -4,6 +4,8 @@ import (
"fmt"
"io/ioutil"
"net/http"
+ "os"
+ "strings"
"github.com/Shugyousha/stasher/input"
"github.com/Shugyousha/stasher/registry"
@@ -23,14 +25,22 @@ type HTTPInput struct {
func New(conf map[string]string) input.Input {
prefix := conf["prefix"]
if prefix == "" {
- fmt.Printf("Need a prefix when setting up http input\n")
- return nil
+ fmt.Fprintf(os.Stderr, "Need a prefix when setting up http input. Exiting.\n")
+ os.Exit(1)
}
+ prefix = strings.Replace(prefix, "\"", "", -1)
+
port := conf["port"]
if port == "" {
- fmt.Printf("Need a port number when setting up http input\n")
- return nil
+ fmt.Fprintf(os.Stderr, "Need a port number when setting up http input. Exiting.\n")
+ os.Exit(1)
+ }
+ port = strings.Replace(port, "\"", "", -1)
+
+ if port[0] != ':' {
+ port = ":" + port
}
+
return &HTTPInput{prefix: prefix, port: port}
}