Added dynamic port

This commit is contained in:
tilo committed 2023-07-08 10:29:47 +02:00
1 parent b5d79ae135
commit 77131adb72
1 file changed
+7 -2
+7 -2
View File
@@ -252,9 +252,14 @@ func main() {
fs := http.FileServer(http.Dir(filepath.Join(storageDir, "data")))
http.Handle("/", cors(fs))
port := os.Getenv("Port")
log.Print("Listening on :60002...")
err := http.ListenAndServe(":60002", nil)
if port == ""{
port = "60002"
}
log.Print("Listening on :" + port + "...")
err := http.ListenAndServe(":" + port, nil)
if err != nil {
log.Fatal(err)
}