diff options
author | Aki <please@ignore.pl> | 2023-12-31 05:16:29 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2023-12-31 05:16:29 +0100 |
commit | a06e585bb3d3c67afd300cfd750d27fb3404a792 (patch) | |
tree | c5e28f2a34a3b9048b7b75dae9581663343e8356 | |
parent | 08e9dc998ad1096c415c43c214731220c5ab34ff (diff) | |
download | rudone-a06e585bb3d3c67afd300cfd750d27fb3404a792.zip rudone-a06e585bb3d3c67afd300cfd750d27fb3404a792.tar.gz rudone-a06e585bb3d3c67afd300cfd750d27fb3404a792.tar.bz2 |
Added stupid and naive configuration for port
-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() { |