Add enableDebug config to turn on logs
This commit is contained in:
		
							parent
							
								
									d67ff2f330
								
							
						
					
					
						commit
						18cf95ed77
					
				| 
						 | 
					@ -23,7 +23,8 @@ redisMaxConnections = 30
 | 
				
			||||||
hmacKey = "secretkey"  # random key for cryptographic signing of video urls
 | 
					hmacKey = "secretkey"  # random key for cryptographic signing of video urls
 | 
				
			||||||
base64Media = false  # use base64 encoding for proxied media urls
 | 
					base64Media = false  # use base64 encoding for proxied media urls
 | 
				
			||||||
enableRSS = true  # set this to false to disable RSS feeds
 | 
					enableRSS = true  # set this to false to disable RSS feeds
 | 
				
			||||||
proxy = "" # proxy type http/https
 | 
					enableDebug = false  # enable request logs and debug endpoints
 | 
				
			||||||
 | 
					proxy = ""  # http/https url, SOCKS proxies are not supported
 | 
				
			||||||
proxyAuth = ""
 | 
					proxyAuth = ""
 | 
				
			||||||
tokenCount = 10
 | 
					tokenCount = 10
 | 
				
			||||||
# minimum amount of usable tokens. tokens are used to authorize API requests,
 | 
					# minimum amount of usable tokens. tokens are used to authorize API requests,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,22 +14,16 @@ proc getConfig*(path: string): (Config, parseCfg.Config) =
 | 
				
			||||||
  var cfg = loadConfig(path)
 | 
					  var cfg = loadConfig(path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  let conf = Config(
 | 
					  let conf = Config(
 | 
				
			||||||
 | 
					    # Server
 | 
				
			||||||
    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),
 | 
					    httpMaxConns: cfg.get("Server", "httpMaxConnections", 100),
 | 
				
			||||||
 | 
					    staticDir: cfg.get("Server", "staticDir", "./public"),
 | 
				
			||||||
    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"),
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    hmacKey: cfg.get("Config", "hmacKey", "secretkey"),
 | 
					 | 
				
			||||||
    base64Media: cfg.get("Config", "base64Media", false),
 | 
					 | 
				
			||||||
    minTokens: cfg.get("Config", "tokenCount", 10),
 | 
					 | 
				
			||||||
    enableRss: cfg.get("Config", "enableRSS", true),
 | 
					 | 
				
			||||||
    proxy: cfg.get("Config", "proxy", ""),
 | 
					 | 
				
			||||||
    proxyAuth: cfg.get("Config", "proxyAuth", ""),
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Cache
 | 
				
			||||||
    listCacheTime: cfg.get("Cache", "listMinutes", 120),
 | 
					    listCacheTime: cfg.get("Cache", "listMinutes", 120),
 | 
				
			||||||
    rssCacheTime: cfg.get("Cache", "rssMinutes", 10),
 | 
					    rssCacheTime: cfg.get("Cache", "rssMinutes", 10),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,7 +31,16 @@ 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", "")
 | 
					    redisPassword: cfg.get("Cache", "redisPassword", ""),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Config
 | 
				
			||||||
 | 
					    hmacKey: cfg.get("Config", "hmacKey", "secretkey"),
 | 
				
			||||||
 | 
					    base64Media: cfg.get("Config", "base64Media", false),
 | 
				
			||||||
 | 
					    minTokens: cfg.get("Config", "tokenCount", 10),
 | 
				
			||||||
 | 
					    enableRss: cfg.get("Config", "enableRSS", true),
 | 
				
			||||||
 | 
					    enableDebug: cfg.get("Config", "enableDebug", false),
 | 
				
			||||||
 | 
					    proxy: cfg.get("Config", "proxy", ""),
 | 
				
			||||||
 | 
					    proxyAuth: cfg.get("Config", "proxyAuth", "")
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (conf, cfg)
 | 
					  return (conf, cfg)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
# SPDX-License-Identifier: AGPL-3.0-only
 | 
					# SPDX-License-Identifier: AGPL-3.0-only
 | 
				
			||||||
import asyncdispatch, strformat
 | 
					import asyncdispatch, strformat, logging
 | 
				
			||||||
from net import Port
 | 
					from net import Port
 | 
				
			||||||
from htmlgen import a
 | 
					from htmlgen import a
 | 
				
			||||||
from os import getEnv
 | 
					from os import getEnv
 | 
				
			||||||
| 
						 | 
					@ -18,8 +18,7 @@ const issuesUrl = "https://github.com/zedeus/nitter/issues"
 | 
				
			||||||
let configPath = getEnv("NITTER_CONF_FILE", "./nitter.conf")
 | 
					let configPath = getEnv("NITTER_CONF_FILE", "./nitter.conf")
 | 
				
			||||||
let (cfg, fullCfg) = getConfig(configPath)
 | 
					let (cfg, fullCfg) = getConfig(configPath)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
when defined(release):
 | 
					if not cfg.enableDebug:
 | 
				
			||||||
  import logging
 | 
					 | 
				
			||||||
  # Silence Jester's query warning
 | 
					  # Silence Jester's query warning
 | 
				
			||||||
  addHandler(newConsoleLogger())
 | 
					  addHandler(newConsoleLogger())
 | 
				
			||||||
  setLogFilter(lvlError)
 | 
					  setLogFilter(lvlError)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -217,6 +217,7 @@ type
 | 
				
			||||||
    base64Media*: bool
 | 
					    base64Media*: bool
 | 
				
			||||||
    minTokens*: int
 | 
					    minTokens*: int
 | 
				
			||||||
    enableRss*: bool
 | 
					    enableRss*: bool
 | 
				
			||||||
 | 
					    enableDebug*: bool
 | 
				
			||||||
    proxy*: string
 | 
					    proxy*: string
 | 
				
			||||||
    proxyAuth*: string
 | 
					    proxyAuth*: string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue