Преглед на файлове

Add support for redis authentication (#420)

* Add support for redis authentication (Update redpool dependency)
 - Add configuration option `redisPassword`

* Reference `redisPassword` in nitter.conf
Vítor преди 5 години
родител
ревизия
fd384ff33e
променени са 5 файла, в които са добавени 5 реда и са изтрити 2 реда
  1. 1 0
      nitter.conf
  2. 1 1
      nitter.nimble
  3. 1 0
      src/config.nim
  4. 1 1
      src/redis_cache.nim
  5. 1 0
      src/types.nim

+ 1 - 0
nitter.conf

@@ -14,6 +14,7 @@ redisHost = "localhost"
 redisPort = 6379
 redisConnections = 20 # connection pool size
 redisMaxConnections = 30
+redisPassword = ""
 # 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
 # you receive tons of requests per second

+ 1 - 1
nitter.nimble

@@ -19,7 +19,7 @@ requires "nimcrypto >= 0.4.11"
 requires "markdown#abdbe5e"
 requires "packedjson#7198cc8"
 requires "supersnappy#1.1.5"
-requires "redpool#57aeb25"
+requires "redpool#f880f49"
 requires "https://github.com/zedeus/redis#94bcbf1"
 requires "https://github.com/disruptek/frosty#0.3.1"
 

+ 1 - 0
src/config.nim

@@ -33,6 +33,7 @@ proc getConfig*(path: string): (Config, parseCfg.Config) =
     redisPort: cfg.get("Cache", "redisPort", 6379),
     redisConns: cfg.get("Cache", "redisConnections", 20),
     redisMaxConns: cfg.get("Cache", "redisMaxConnections", 30),
+    redisPassword: cfg.get("Cache", "redisPassword", ""),
 
     replaceYouTube: cfg.get("Preferences", "replaceYouTube", "piped.kavin.rocks")
   )

+ 1 - 1
src/redis_cache.nim

@@ -30,7 +30,7 @@ proc migrate*(key, match: string) {.async.} =
 proc initRedisPool*(cfg: Config) {.async.} =
   try:
     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("oldFrosty", "*")

+ 1 - 0
src/types.nim

@@ -220,6 +220,7 @@ type
     redisPort*: int
     redisConns*: int
     redisMaxConns*: int
+    redisPassword*: string
 
     replaceYouTube*: string