diff options
-rw-r--r-- | main.go | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -5,6 +5,7 @@ import ( "encoding/json" "log" "net/http" + "os" "github.com/gorilla/mux" ) @@ -43,7 +44,16 @@ func handleRequests() { router.HandleFunc("/entry", handleEntryPost).Methods("POST") router.HandleFunc("/entry", handleEntryOptions).Methods("OPTIONS") router.PathPrefix("/").Handler(http.FileServer(http.FS(content))) - log.Fatal(http.ListenAndServe(":8080", router)) + log.Fatal(http.ListenAndServe(configure(), router)) +} + +func configure() string { + at := os.Getenv("STATSAT") + if at == "" { + log.Println("Defaulting to STATSAT=:8080") + at = ":8080" + } + return at } func main() { |