From 9733bd2f0791ba8a83929522c971724367321030 Mon Sep 17 00:00:00 2001 From: servostar Date: Fri, 24 Nov 2023 23:42:32 +0100 Subject: [PATCH] bind address can be configured by environment variables --- main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 51cdcff..02b5099 100644 --- a/main.go +++ b/main.go @@ -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)) }