can pass ip
parent
981c850edf
commit
46de2a126c
4
main.go
4
main.go
|
|
@ -33,6 +33,7 @@ var (
|
|||
func main() {
|
||||
fs = args.NewArgSet()
|
||||
fs.Append(args.STRING, "p", "port to serve", "8100")
|
||||
fs.Append(args.STRING, "ip", "ip to serve", "")
|
||||
fs.Append(args.STRING, "u", "user:pass for basic auth", "")
|
||||
fs.Append(args.BOOL, "md", "whether to render markdown as html", true)
|
||||
fs.Append(args.BOOL, "log", "emit access logs", false)
|
||||
|
|
@ -97,13 +98,14 @@ func main() {
|
|||
b,
|
||||
)
|
||||
}
|
||||
ip := fs.Get("ip").GetString()
|
||||
p := strings.TrimPrefix(fs.Get("p").GetString(), ":")
|
||||
|
||||
http.Handle("/", http.HandlerFunc(handler(userPass, https, ro, d, md, mdCss, mdClass, accessLogging)))
|
||||
|
||||
log.Printf("Serving %s on HTTP port: %s\n", d, p)
|
||||
|
||||
log.Fatal(http.ListenAndServe(":"+p, nil))
|
||||
log.Fatal(http.ListenAndServe(ip+":"+p, nil))
|
||||
}
|
||||
|
||||
func handler(userPass string, https, ro bool, d string, md bool, mdCss, mdClass string, accessLogging bool) http.HandlerFunc {
|
||||
|
|
|
|||
Loading…
Reference in New Issue