Add support for redis authentication (#420)
* Add support for redis authentication (Update redpool dependency) - Add configuration option `redisPassword` * Reference `redisPassword` in nitter.conf
This commit is contained in:
parent
6c5cb01b29
commit
fd384ff33e
5 changed files with 5 additions and 2 deletions
|
@ -14,6 +14,7 @@ redisHost = "localhost"
|
||||||
redisPort = 6379
|
redisPort = 6379
|
||||||
redisConnections = 20 # connection pool size
|
redisConnections = 20 # connection pool size
|
||||||
redisMaxConnections = 30
|
redisMaxConnections = 30
|
||||||
|
redisPassword = ""
|
||||||
# max, new connections are opened when none are available, but if the pool size
|
# max, new connections are opened when none are available, but if the pool size
|
||||||
# goes above this, they're closed when released. don't worry about this unless
|
# goes above this, they're closed when released. don't worry about this unless
|
||||||
# you receive tons of requests per second
|
# you receive tons of requests per second
|
||||||
|
|
|
@ -19,7 +19,7 @@ requires "nimcrypto >= 0.4.11"
|
||||||
requires "markdown#abdbe5e"
|
requires "markdown#abdbe5e"
|
||||||
requires "packedjson#7198cc8"
|
requires "packedjson#7198cc8"
|
||||||
requires "supersnappy#1.1.5"
|
requires "supersnappy#1.1.5"
|
||||||
requires "redpool#57aeb25"
|
requires "redpool#f880f49"
|
||||||
requires "https://github.com/zedeus/redis#94bcbf1"
|
requires "https://github.com/zedeus/redis#94bcbf1"
|
||||||
requires "https://github.com/disruptek/frosty#0.3.1"
|
requires "https://github.com/disruptek/frosty#0.3.1"
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ proc getConfig*(path: string): (Config, parseCfg.Config) =
|
||||||
redisPort: cfg.get("Cache", "redisPort", 6379),
|
redisPort: cfg.get("Cache", "redisPort", 6379),
|
||||||
redisConns: cfg.get("Cache", "redisConnections", 20),
|
redisConns: cfg.get("Cache", "redisConnections", 20),
|
||||||
redisMaxConns: cfg.get("Cache", "redisMaxConnections", 30),
|
redisMaxConns: cfg.get("Cache", "redisMaxConnections", 30),
|
||||||
|
redisPassword: cfg.get("Cache", "redisPassword", ""),
|
||||||
|
|
||||||
replaceYouTube: cfg.get("Preferences", "replaceYouTube", "piped.kavin.rocks")
|
replaceYouTube: cfg.get("Preferences", "replaceYouTube", "piped.kavin.rocks")
|
||||||
)
|
)
|
||||||
|
|
|
@ -30,7 +30,7 @@ proc migrate*(key, match: string) {.async.} =
|
||||||
proc initRedisPool*(cfg: Config) {.async.} =
|
proc initRedisPool*(cfg: Config) {.async.} =
|
||||||
try:
|
try:
|
||||||
pool = await newRedisPool(cfg.redisConns, maxConns=cfg.redisMaxConns,
|
pool = await newRedisPool(cfg.redisConns, maxConns=cfg.redisMaxConns,
|
||||||
host=cfg.redisHost, port=cfg.redisPort)
|
host=cfg.redisHost, port=cfg.redisPort, password=cfg.redisPassword)
|
||||||
|
|
||||||
await migrate("snappyRss", "rss:*")
|
await migrate("snappyRss", "rss:*")
|
||||||
await migrate("oldFrosty", "*")
|
await migrate("oldFrosty", "*")
|
||||||
|
|
|
@ -220,6 +220,7 @@ type
|
||||||
redisPort*: int
|
redisPort*: int
|
||||||
redisConns*: int
|
redisConns*: int
|
||||||
redisMaxConns*: int
|
redisMaxConns*: int
|
||||||
|
redisPassword*: string
|
||||||
|
|
||||||
replaceYouTube*: string
|
replaceYouTube*: string
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue