Specify port with -port argument
All checks were successful
the build was successful

This commit is contained in:
Peter Stuifzand 2019-02-18 20:47:55 +01:00
parent 53bb6bdf23
commit f1695c3136

View File

@ -1,6 +1,7 @@
package main
import (
"flag"
"fmt"
"gitlab.com/golang-commonmark/markdown"
"html/template"
@ -409,6 +410,10 @@ func (h *recentHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
func main() {
var port int
flag.IntVar(&port, "port", 8080, "http port")
flag.Parse()
mp = NewFilePages("data")
http.Handle("/auth/", &authHandler{})
@ -419,6 +424,6 @@ func main() {
http.Handle("/recent/", &recentHandler{})
http.Handle("/", &indexHandler{})
fmt.Printf("Running on port 8080")
log.Fatal(http.ListenAndServe(":8080", nil))
fmt.Printf("Running on port %d\n", port)
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), nil))
}