Skip to content

Commit

Permalink
Merge pull request #75 from bavix/build-fix
Browse files Browse the repository at this point in the history
add log
  • Loading branch information
rez1dent3 authored Dec 15, 2023
2 parents 9ab0cd0 + e661e5d commit 428eea6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import (
"errors"
"io/fs"
"log"
"net"
"net/http"
"os"
)

//go:embed public
Expand All @@ -19,7 +21,16 @@ func main() {

http.Handle("/", http.FileServer(http.FS(htmlContent)))

err = http.ListenAndServe(":8080", nil)
host, _ := os.LookupEnv("HOST")
port, ok := os.LookupEnv("PORT")
if !ok {
port = "8080"
}

addr := net.JoinHostPort(host, port)
log.Printf("Listening on %s...\n", addr)

err = http.ListenAndServe(addr, nil)
if err != nil && !errors.Is(err, http.ErrServerClosed) {
log.Fatal(err)
}
Expand Down

0 comments on commit 428eea6

Please sign in to comment.