Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>
all: make bind address configurable
main.go | 11 ++++++-----
diff --git a/main.go b/main.go index 844b82d91eee9a0d8d483b380db875fda7ea65ce..b1431001fac75ea09e1c13e2a52e7ce49986cee0 100644 --- a/main.go +++ b/main.go @@ -12,19 +12,20 @@ "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" "github.com/yuin/goldmark" + "github.com/yuin/goldmark-meta" "github.com/yuin/goldmark/extension" "github.com/yuin/goldmark/parser" - "github.com/yuin/goldmark-meta" ) type Document struct { Title string Content template.HTML - Meta map[string]interface{} + Meta map[string]interface{} } var ( wikiPath string + bind string ) //go:embed templates/* @@ -38,6 +39,7 @@ } func main() { flag.StringVar(&wikiPath, "wiki", wikiPath, "Wiki path") + flag.StringVar(&bind, "bind", ":3000", "Address for server to bind to") flag.Parse() // TODO: Write an actual man page @@ -114,7 +116,6 @@ return } }) - // TODO: Make this configurable - log.Printf("Alive, at :3000") - http.ListenAndServe(":3000", router) + log.Printf("Alive, at %s", bind) + http.ListenAndServe(bind, router) }