diff options
Diffstat (limited to 'grimtube.go')
| -rw-r--r-- | grimtube.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/grimtube.go b/grimtube.go index 416bc7f..ef51f0c 100644 --- a/grimtube.go +++ b/grimtube.go @@ -1,8 +1,10 @@ package main import ( + "flag" "text/template" "net/http" + "fmt" //"io" "log" "strconv" @@ -95,6 +97,8 @@ func favicon(w http.ResponseWriter, r *http.Request) { } func main() { + port := flag.Int("p", 8080, "The port to bind to.") + flag.Parse() fs := http.FileServer(http.Dir("static")) http.Handle("/static/", http.StripPrefix("/static/", fs)) http.HandleFunc("/favicon.ico", favicon) @@ -102,5 +106,5 @@ func main() { http.HandleFunc("/search", search) http.HandleFunc("/embed", embed) - log.Fatal(http.ListenAndServe(":8080", nil)) + log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", *port), nil)) } |
