feat: Add flag for bind host

This commit is contained in:
ptrcnull 2022-03-01 21:29:08 +01:00
parent 9f6190a762
commit 3213366262
Signed by: ptrcnull
GPG key ID: 411F7B30801DD9CA

View file

@ -29,6 +29,7 @@ func RandString(n int) string {
var dataDirFlag = flag.String("dataDir", "/tmp", "directory for files")
var domainFlag = flag.String("domain", "http://localhost:8085", "base domain")
var bindFlag = flag.String("bind", ":8085", "host and port to bind")
func main() {
h := &Handler{
@ -36,7 +37,7 @@ func main() {
Domain: *domainFlag,
}
log.Println("listening")
panic(http.ListenAndServe(":8085", h))
panic(http.ListenAndServe(*bindFlag, h))
}
type Handler struct {