Fix listen address and port passing

Only HOST & PORT env variables used by gin internally were really used, pass resulting config to gin so we match documentation, and log it on startup
This commit is contained in:
Łukasz Mierzwa
2017-12-03 10:26:41 -08:00
parent 65a27b39df
commit e23b00c080
3 changed files with 6 additions and 3 deletions

View File

@@ -25,7 +25,7 @@ labels:
keep: []
strip: []
listen:
address: "*"
address: "0.0.0.0"
port: 8080
prefix: /
log:

View File

@@ -62,7 +62,7 @@ func init() {
pflag.StringSlice("receivers.strip", []string{},
"List of receivers to not display alerts for")
pflag.String("listen.address", "*", "IP/Hostname to listen on")
pflag.String("listen.address", "", "IP/Hostname to listen on")
pflag.Int("listen.port", 8080, "HTTP port to listen on")
pflag.String("listen.prefix", "/", "URL prefix")

View File

@@ -1,6 +1,7 @@
package main
import (
"fmt"
"html/template"
"path"
"strings"
@@ -150,7 +151,9 @@ func main() {
}
setupRouter(router)
err := router.Run()
listen := fmt.Sprintf("%s:%d", config.Config.Listen.Address, config.Config.Listen.Port)
log.Infof("Listening on %s", listen)
err := router.Run(listen)
if err != nil {
log.Fatal(err)
}