diff --git a/cmd/server/main.go b/cmd/server/main.go index ca99f5d..fcc3a16 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -108,6 +108,11 @@ func main() { // Assemble final handler chain: DefaultServeMux -> AuthMiddleware -> CorsHandler finalHandler := middleware.AuthMiddleware(http.DefaultServeMux) - log.Println("Server starting on :8081") - log.Fatal(http.ListenAndServe(":8081", corsHandler(finalHandler))) + port := os.Getenv("PORT") + if port == "" { + port = "8081" + } + addr := ":" + port + log.Println("Server starting on " + addr) + log.Fatal(http.ListenAndServe(addr, corsHandler(finalHandler))) }