Silence Jester's query warning

This commit is contained in:
Zed 2020-06-07 09:18:40 +02:00
parent 558fc7a8a0
commit 1b9fa40237
2 changed files with 14 additions and 2 deletions

View file

@ -1,4 +1,4 @@
import asyncdispatch import asyncdispatch, logging, strformat
from net import Port from net import Port
import jester import jester
@ -12,11 +12,22 @@ import routes/[
const configPath {.strdefine.} = "./nitter.conf" const configPath {.strdefine.} = "./nitter.conf"
let (cfg, fullCfg) = getConfig(configPath) let (cfg, fullCfg) = getConfig(configPath)
# Silence Jester's query warning
addHandler(newConsoleLogger())
setLogFilter(lvlError)
let http = if cfg.useHttps: "https" else: "http"
stdout.write &"Starting Nitter at {http}://{cfg.hostname}\n"
stdout.flushFile
updateDefaultPrefs(fullCfg) updateDefaultPrefs(fullCfg)
setCacheTimes(cfg) setCacheTimes(cfg)
setHmacKey(cfg.hmacKey) setHmacKey(cfg.hmacKey)
waitFor initRedisPool(cfg) waitFor initRedisPool(cfg)
stdout.write &"Connected to Redis at {cfg.redisHost}:{cfg.redisPort}\n"
stdout.flushFile
asyncCheck initTokenPool(cfg) asyncCheck initTokenPool(cfg)
createUnsupportedRouter(cfg) createUnsupportedRouter(cfg)

View file

@ -36,7 +36,8 @@ proc initRedisPool*(cfg: Config) {.async.} =
await migrate("frosty", "*") await migrate("frosty", "*")
except OSError: except OSError:
echo "Failed to connect to Redis." stdout.write "Failed to connect to Redis.\n"
stdout.flushFile
quit(1) quit(1)
template toKey(p: Profile): string = "p:" & toLower(p.username) template toKey(p: Profile): string = "p:" & toLower(p.username)