Expand configuration (#368)
* Allow configuring httpMaxConns default: 100 * Allow setting NITTER_CONF_FILE path env var Co-authored-by: 3nprob <3nprob@3nprob>
This commit is contained in:
parent
46cf3e3a91
commit
a859943871
|
@ -2,6 +2,7 @@
|
||||||
address = "0.0.0.0"
|
address = "0.0.0.0"
|
||||||
port = 8080
|
port = 8080
|
||||||
https = false # disable to enable cookies when not using https
|
https = false # disable to enable cookies when not using https
|
||||||
|
httpMaxConnections = 100
|
||||||
staticDir = "./public"
|
staticDir = "./public"
|
||||||
title = "nitter"
|
title = "nitter"
|
||||||
hostname = "nitter.net"
|
hostname = "nitter.net"
|
||||||
|
|
|
@ -16,6 +16,8 @@ proc getConfig*(path: string): (Config, parseCfg.Config) =
|
||||||
address: cfg.get("Server", "address", "0.0.0.0"),
|
address: cfg.get("Server", "address", "0.0.0.0"),
|
||||||
port: cfg.get("Server", "port", 8080),
|
port: cfg.get("Server", "port", 8080),
|
||||||
useHttps: cfg.get("Server", "https", true),
|
useHttps: cfg.get("Server", "https", true),
|
||||||
|
httpMaxConns: cfg.get("Server", "httpMaxConnections", 100),
|
||||||
|
|
||||||
title: cfg.get("Server", "title", "Nitter"),
|
title: cfg.get("Server", "title", "Nitter"),
|
||||||
hostname: cfg.get("Server", "hostname", "nitter.net"),
|
hostname: cfg.get("Server", "hostname", "nitter.net"),
|
||||||
staticDir: cfg.get("Server", "staticDir", "./public"),
|
staticDir: cfg.get("Server", "staticDir", "./public"),
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import asyncdispatch, strformat
|
import asyncdispatch, strformat
|
||||||
from net import Port
|
from net import Port
|
||||||
from htmlgen import a
|
from htmlgen import a
|
||||||
|
from os import getEnv
|
||||||
|
|
||||||
import jester
|
import jester
|
||||||
|
|
||||||
|
@ -12,7 +13,7 @@ import routes/[
|
||||||
|
|
||||||
const instancesUrl = "https://github.com/zedeus/nitter/wiki/Instances"
|
const instancesUrl = "https://github.com/zedeus/nitter/wiki/Instances"
|
||||||
|
|
||||||
const configPath {.strdefine.} = "./nitter.conf"
|
let configPath = getEnv("NITTER_CONF_FILE", "./nitter.conf")
|
||||||
let (cfg, fullCfg) = getConfig(configPath)
|
let (cfg, fullCfg) = getConfig(configPath)
|
||||||
|
|
||||||
when defined(release):
|
when defined(release):
|
||||||
|
@ -28,7 +29,7 @@ updateDefaultPrefs(fullCfg)
|
||||||
setCacheTimes(cfg)
|
setCacheTimes(cfg)
|
||||||
setHmacKey(cfg.hmacKey)
|
setHmacKey(cfg.hmacKey)
|
||||||
setProxyEncoding(cfg.base64Media)
|
setProxyEncoding(cfg.base64Media)
|
||||||
setMaxHttpConns(100)
|
setMaxHttpConns(cfg.httpMaxConns)
|
||||||
|
|
||||||
waitFor initRedisPool(cfg)
|
waitFor initRedisPool(cfg)
|
||||||
stdout.write &"Connected to Redis at {cfg.redisHost}:{cfg.redisPort}\n"
|
stdout.write &"Connected to Redis at {cfg.redisHost}:{cfg.redisPort}\n"
|
||||||
|
|
|
@ -204,6 +204,7 @@ type
|
||||||
address*: string
|
address*: string
|
||||||
port*: int
|
port*: int
|
||||||
useHttps*: bool
|
useHttps*: bool
|
||||||
|
httpMaxConns*: int
|
||||||
title*: string
|
title*: string
|
||||||
hostname*: string
|
hostname*: string
|
||||||
staticDir*: string
|
staticDir*: string
|
||||||
|
|
Loading…
Reference in New Issue