Skip to content

Commit

Permalink
make the listening port configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
HeavyHorst committed Oct 25, 2016
1 parent f4e47cf commit 62874ee
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"flag"
"log"
"net/http"
"os"
Expand All @@ -11,7 +12,17 @@ import (
"github.com/rs/xlog"
)

var (
port string
)

func init() {
const defaultPort = "8080"
flag.StringVar(&port, "p", defaultPort, "the port to listen on")
}

func main() {
flag.Parse()
var err error
db, err := newBoltStore()
if err != nil {
Expand Down Expand Up @@ -54,5 +65,5 @@ func main() {

r.FileServer("/", http.Dir("./dashboard/"))

log.Fatal(http.ListenAndServe(":8080", r))
log.Fatal(http.ListenAndServe(":"+port, r))
}

0 comments on commit 62874ee

Please sign in to comment.