Skip to content

Commit

Permalink
Allow specifying listen addr
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall authored Nov 3, 2023
1 parent fa70cdd commit 7eb0144
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ func init() {
func main() {
http.HandleFunc("/proxyUrl", checkUrl)

log.Println("Server listening on :8080")
if err := http.ListenAndServe(":8080", nil); err != nil {
listen := os.Getenv("LISTEN")
if listen == "" {
listen = "127.0.0.1:8888"
}

log.Printf("Server listening on %s\n", listen)
if err := http.ListenAndServe(listen, nil); err != nil {
panic(err)
}
}
Expand Down

0 comments on commit 7eb0144

Please sign in to comment.