fix: do not tolower on secret_key
This commit is contained in:
parent
76e9807a34
commit
6a8c4ea562
1 changed files with 12 additions and 8 deletions
|
@ -43,8 +43,12 @@ func getEnvBool(key string, def bool) bool {
|
||||||
return v == "true"
|
return v == "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
func getEnvString(key string, def string) string {
|
func getEnvString(key string, def string, tolower bool) string {
|
||||||
v := strings.ToLower(getenv(key))
|
var v string
|
||||||
|
if tolower {
|
||||||
|
v = strings.ToLower(getenv(key))
|
||||||
|
}
|
||||||
|
v = getenv(key)
|
||||||
if v == "" {
|
if v == "" {
|
||||||
return def
|
return def
|
||||||
}
|
}
|
||||||
|
@ -69,10 +73,10 @@ func LoadConfig() {
|
||||||
Uds: getEnvBool("ENABLE_UDS", true),
|
Uds: getEnvBool("ENABLE_UDS", true),
|
||||||
// I would use `/run/http3-proxy` here, but `/run` is not user writable
|
// I would use `/run/http3-proxy` here, but `/run` is not user writable
|
||||||
// which is kinda anoying when developing.
|
// which is kinda anoying when developing.
|
||||||
Uds_path: getEnvString("UDS_PATH", "/tmp/http-ytproxy.sock"),
|
Uds_path: getEnvString("UDS_PATH", "/tmp/http-ytproxy.sock", true),
|
||||||
Host: getEnvString("HOST", "0.0.0.0"),
|
Host: getEnvString("HOST", "0.0.0.0", true),
|
||||||
Port: getEnvString("PORT", "8080"),
|
Port: getEnvString("PORT", "8080", true),
|
||||||
Proxy: getEnvString("PROXY", ""),
|
Proxy: getEnvString("PROXY", "", true),
|
||||||
Http_client_ver: getEnvInt("HTTP_CLIENT_VER", 1),
|
Http_client_ver: getEnvInt("HTTP_CLIENT_VER", 1),
|
||||||
Ipv6_only: getEnvBool("IPV6_ONLY", false),
|
Ipv6_only: getEnvBool("IPV6_ONLY", false),
|
||||||
Gluetun: struct {
|
Gluetun: struct {
|
||||||
|
@ -80,12 +84,12 @@ func LoadConfig() {
|
||||||
Block_checker bool
|
Block_checker bool
|
||||||
Block_checker_cooldown int
|
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: getEnvBool("BLOCK_CHECKER", true),
|
||||||
Block_checker_cooldown: getEnvInt("BLOCK_CHECKER_COOLDOWN", 60),
|
Block_checker_cooldown: getEnvInt("BLOCK_CHECKER_COOLDOWN", 60),
|
||||||
},
|
},
|
||||||
Companion: struct{ Secret_key string }{
|
Companion: struct{ Secret_key string }{
|
||||||
Secret_key: getEnvString("SECRET_KEY", ""),
|
Secret_key: getEnvString("SECRET_KEY", "", false),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue