bind address can be configured by environment variables

This commit is contained in:
Sven Vogel 2023-11-24 23:42:32 +01:00
parent 6e2f5d4b1a
commit 9733bd2f07
1 changed files with 4 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import (
"html/template"
"log"
"net/http"
"os"
"strconv"
)
@ -85,5 +86,7 @@ func main() {
tmpl.Execute(w, status)
})
log.Fatal(http.ListenAndServe("127.0.0.1:8000", nil))
var address = fmt.Sprintf("%s:%s", os.Getenv("BIND"), os.Getenv("PORT"))
log.Fatal(http.ListenAndServe(address, nil))
}