summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/main.go b/main.go
index 6d92d32..036b47c 100644
--- a/main.go
+++ b/main.go
@@ -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() {