Get port from env

This commit is contained in:
Brieuc Dubois 2023-12-23 16:03:15 +01:00
parent efad3bb70b
commit 367f53062d
1 changed files with 3 additions and 3 deletions

View File

@ -24,11 +24,11 @@ func Server() {
http.HandleFunc("/p/", pixelHandler)
http.HandleFunc("/dashboard", dashboardHandler)
addr := ":80"
port := getenv("PORT", "80")
fmt.Printf("Server is up and running on port %s\n", addr)
fmt.Printf("Server is up and running on port %s\n", port)
log.Fatal(http.ListenAndServe(addr, nil))
log.Fatal(http.ListenAndServe(":"+port, nil))
}
type PixelStats struct {