11
main.go
11
main.go
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
@ -21,6 +22,16 @@ func main() {
|
||||
ReadTimeout: 25 * time.Second,
|
||||
}
|
||||
|
||||
PROXY_ENV := os.Getenv("PROXY")
|
||||
if PROXY_ENV != "" {
|
||||
if _, err := url.ParseRequestURI(PROXY_ENV); err != nil {
|
||||
logger.Error("invalid proxy")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
logger.Info("using a custom proxy for requests")
|
||||
}
|
||||
|
||||
port, _ := strconv.Atoi(os.Getenv("PORT"))
|
||||
|
||||
if port == 0 {
|
||||
|
Reference in New Issue
Block a user