fix: do not tolower on secret_key

This commit is contained in:
Fijxu 2025-03-24 21:53:47 -03:00
parent 76e9807a34
commit 6a8c4ea562

View file

@ -43,8 +43,12 @@ func getEnvBool(key string, def bool) bool {
return v == "true"
}
func getEnvString(key string, def string) string {
v := strings.ToLower(getenv(key))
func getEnvString(key string, def string, tolower bool) string {
var v string
if tolower {
v = strings.ToLower(getenv(key))
}
v = getenv(key)
if v == "" {
return def
}
@ -69,10 +73,10 @@ func LoadConfig() {
Uds: getEnvBool("ENABLE_UDS", true),
// I would use `/run/http3-proxy` here, but `/run` is not user writable
// which is kinda anoying when developing.
Uds_path: getEnvString("UDS_PATH", "/tmp/http-ytproxy.sock"),
Host: getEnvString("HOST", "0.0.0.0"),
Port: getEnvString("PORT", "8080"),
Proxy: getEnvString("PROXY", ""),
Uds_path: getEnvString("UDS_PATH", "/tmp/http-ytproxy.sock", true),
Host: getEnvString("HOST", "0.0.0.0", true),
Port: getEnvString("PORT", "8080", true),
Proxy: getEnvString("PROXY", "", true),
Http_client_ver: getEnvInt("HTTP_CLIENT_VER", 1),
Ipv6_only: getEnvBool("IPV6_ONLY", false),
Gluetun: struct {
@ -80,12 +84,12 @@ func LoadConfig() {
Block_checker bool
Block_checker_cooldown int
}{
Gluetun_api: getEnvString("GLUETUN_API", "127.0.0.1:8000"),
Gluetun_api: getEnvString("GLUETUN_API", "127.0.0.1:8000", true),
Block_checker: getEnvBool("BLOCK_CHECKER", true),
Block_checker_cooldown: getEnvInt("BLOCK_CHECKER_COOLDOWN", 60),
},
Companion: struct{ Secret_key string }{
Secret_key: getEnvString("SECRET_KEY", ""),
Secret_key: getEnvString("SECRET_KEY", "", false),
},
}
}