Improve handling of env vars, blank config entries when not present in .env

This commit is contained in:
appletalk 2022-05-19 13:52:04 -07:00
parent 3e95be01ac
commit d19f284855
3 changed files with 35 additions and 13 deletions

View File

@ -9,16 +9,16 @@ LETS_ENCRYPT_ENV=production
NITTER_TITLE=Nitter
NITTER_HOSTNAME=$DOMAIN
NITTER_BASE64_MEDIA=false
NITTER_ENABLE_RSS=true
NITTER_ENABLE_DEBUG=false
NITTER_THEME=Nitter
NITTER_REPLACE_TWITTER='""'
NITTER_REPLACE_YOUTUBE='""'
NITTER_REPLACE_REDDIT='""'
NITTER_REPLACE_INSTAGRAM='""'
NITTER_PROXY_VIDEOS=true
NITTER_HLS_PLAYBACK=false
NITTER_INFINITE_SCROLL=false
#NITTER_BASE64_MEDIA=false
#NITTER_ENABLE_RSS=true
#NITTER_ENABLE_DEBUG=false
#NITTER_THEME=Nitter
#NITTER_REPLACE_TWITTER=twitter.example.com
#NITTER_REPLACE_YOUTUBE=invidious.example.com
#NITTER_REPLACE_REDDIT=libreddit.example.com
#NITTER_REPLACE_INSTAGRAM=bibliogram.example.com
#NITTER_PROXY_VIDEOS=true
#NITTER_HLS_PLAYBACK=false
#NITTER_INFINITE_SCROLL=false
SECRET_HMAC_KEY_VERSION=v1 # length=64

View File

@ -1 +1 @@
export NITTER_CONF_VERSION=v1
export NITTER_CONF_VERSION=v2

View File

@ -12,7 +12,7 @@ listMinutes = 240 # how long to cache list info (not the tweets, so keep it hig
rssMinutes = 10 # how long to cache rss queries
redisHost = "redis"
redisPort = 6379
#redisPassword = ""
redisPassword = ""
redisConnections = 20 # connection pool size
redisMaxConnections = 30
# max, new connections are opened when none are available, but if the pool size
@ -21,9 +21,15 @@ redisMaxConnections = 30
[Config]
hmacKey = {{ secret "hmac_key" }} # random key for cryptographic signing of video urls
{{- if env "NITTER_BASE64_MEDIA" }}
base64Media = {{ env "NITTER_BASE64_MEDIA" }} # use base64 encoding for proxied media urls
{{- end }}
{{- if env "NITTER_ENABLE_RSS" }}
enableRSS = {{ env "NITTER_ENABLE_RSS" }} # set this to false to disable RSS feeds
{{- end }}
{{- if env "NITTER_ENABLE_DEBUG" }}
enableDebug = {{ env "NITTER_ENABLE_DEBUG" }} # enable request logs and debug endpoints
{{- end }}
proxy = "" # http/https url, SOCKS proxies are not supported
proxyAuth = ""
tokenCount = 10
@ -35,11 +41,27 @@ tokenCount = 10
# Change default preferences here, see src/prefs_impl.nim for a complete list
[Preferences]
{{- if env "NITTER_THEME" }}
theme = {{ env "NITTER_THEME" }}
{{- end }}
{{- if env "NITTER_REPLACE_TWITTER" }}
replaceTwitter = {{ env "NITTER_REPLACE_TWITTER" }}
{{- end }}
{{- if env "NITTER_REPLACE_YOUTUBE" }}
replaceYouTube = {{ env "NITTER_REPLACE_YOUTUBE" }}
{{- end }}
{{- if env "NITTER_REPLACE_REDDIT" }}
replaceReddit = {{ env "NITTER_REPLACE_REDDIT" }}
{{- end }}
{{- if env "NITTER_REPLACE_INSTAGRAM" }}
replaceInstagram = {{ env "NITTER_REPLACE_INSTAGRAM" }}
{{- end }}
{{- if env "NITTER_PROXY_VIDEOS" }}
proxyVideos = {{ env "NITTER_PROXY_VIDEOS" }}
{{- end }}
{{- if env "NITTER_HLS_PLAYBACK" }}
hlsPlayback = {{ env "NITTER_HLS_PLAYBACK" }}
{{- end }}
{{- if env "NITTER_INFINITE_SCROLL" }}
infiniteScroll = {{ env "NITTER_INFINITE_SCROLL" }}
{{- end }}