fix env vars

This commit is contained in:
Gianni Carafa
2023-11-08 02:17:16 +01:00
parent 719373bb7d
commit afca5eda80
2 changed files with 6 additions and 10 deletions

View File

@@ -7,7 +7,6 @@ import (
"ladder/handlers"
"log"
"os"
"strconv"
"strings"
"github.com/akamensky/argparse"
@@ -23,20 +22,13 @@ func main() {
parser := argparse.NewParser("ladder", "Every Wall needs a Ladder")
p := os.Getenv("PORT")
if os.Getenv("PORT") == "" {
p = "8080"
}
port := parser.String("p", "port", &argparse.Options{
Required: false,
Default: p,
Default: os.Getenv("PORT"),
Help: "Port the webserver will listen on"})
pf, _ := strconv.ParseBool(os.Getenv("PREFORK"))
prefork := parser.Flag("P", "prefork", &argparse.Options{
Required: false,
Default: pf,
Help: "This will spawn multiple processes listening"})
err := parser.Parse(os.Args)
@@ -44,6 +36,10 @@ func main() {
fmt.Print(parser.Usage(err))
}
if os.Getenv("PREFORK") == "true" {
*prefork = true
}
app := fiber.New(
fiber.Config{
Prefork: *prefork,

View File

@@ -56,7 +56,7 @@ func fetchSite(urlpath string, queries map[string]string) (string, *http.Request
return "", nil, nil, fmt.Errorf("domain not allowed. %s not in %s", u.Host, allowedDomains)
}
if os.Getenv("DEBUG ") == "true" {
if os.Getenv("LOG_URLS ") == "true" {
log.Println(u.String() + urlQuery)
}