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_TITLE=Nitter
NITTER_HOSTNAME=$DOMAIN NITTER_HOSTNAME=$DOMAIN
NITTER_BASE64_MEDIA=false #NITTER_BASE64_MEDIA=false
NITTER_ENABLE_RSS=true #NITTER_ENABLE_RSS=true
NITTER_ENABLE_DEBUG=false #NITTER_ENABLE_DEBUG=false
NITTER_THEME=Nitter #NITTER_THEME=Nitter
NITTER_REPLACE_TWITTER='""' #NITTER_REPLACE_TWITTER=twitter.example.com
NITTER_REPLACE_YOUTUBE='""' #NITTER_REPLACE_YOUTUBE=invidious.example.com
NITTER_REPLACE_REDDIT='""' #NITTER_REPLACE_REDDIT=libreddit.example.com
NITTER_REPLACE_INSTAGRAM='""' #NITTER_REPLACE_INSTAGRAM=bibliogram.example.com
NITTER_PROXY_VIDEOS=true #NITTER_PROXY_VIDEOS=true
NITTER_HLS_PLAYBACK=false #NITTER_HLS_PLAYBACK=false
NITTER_INFINITE_SCROLL=false #NITTER_INFINITE_SCROLL=false
SECRET_HMAC_KEY_VERSION=v1 # length=64 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 rssMinutes = 10 # how long to cache rss queries
redisHost = "redis" redisHost = "redis"
redisPort = 6379 redisPort = 6379
#redisPassword = "" redisPassword = ""
redisConnections = 20 # connection pool size redisConnections = 20 # connection pool size
redisMaxConnections = 30 redisMaxConnections = 30
# 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
@ -21,9 +21,15 @@ redisMaxConnections = 30
[Config] [Config]
hmacKey = {{ secret "hmac_key" }} # random key for cryptographic signing of video urls 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 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 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 enableDebug = {{ env "NITTER_ENABLE_DEBUG" }} # enable request logs and debug endpoints
{{- end }}
proxy = "" # http/https url, SOCKS proxies are not supported proxy = "" # http/https url, SOCKS proxies are not supported
proxyAuth = "" proxyAuth = ""
tokenCount = 10 tokenCount = 10
@ -35,11 +41,27 @@ tokenCount = 10
# Change default preferences here, see src/prefs_impl.nim for a complete list # Change default preferences here, see src/prefs_impl.nim for a complete list
[Preferences] [Preferences]
{{- if env "NITTER_THEME" }}
theme = {{ env "NITTER_THEME" }} theme = {{ env "NITTER_THEME" }}
{{- end }}
{{- if env "NITTER_REPLACE_TWITTER" }}
replaceTwitter = {{ env "NITTER_REPLACE_TWITTER" }} replaceTwitter = {{ env "NITTER_REPLACE_TWITTER" }}
{{- end }}
{{- if env "NITTER_REPLACE_YOUTUBE" }}
replaceYouTube = {{ env "NITTER_REPLACE_YOUTUBE" }} replaceYouTube = {{ env "NITTER_REPLACE_YOUTUBE" }}
{{- end }}
{{- if env "NITTER_REPLACE_REDDIT" }}
replaceReddit = {{ env "NITTER_REPLACE_REDDIT" }} replaceReddit = {{ env "NITTER_REPLACE_REDDIT" }}
{{- end }}
{{- if env "NITTER_REPLACE_INSTAGRAM" }}
replaceInstagram = {{ env "NITTER_REPLACE_INSTAGRAM" }} replaceInstagram = {{ env "NITTER_REPLACE_INSTAGRAM" }}
{{- end }}
{{- if env "NITTER_PROXY_VIDEOS" }}
proxyVideos = {{ env "NITTER_PROXY_VIDEOS" }} proxyVideos = {{ env "NITTER_PROXY_VIDEOS" }}
{{- end }}
{{- if env "NITTER_HLS_PLAYBACK" }}
hlsPlayback = {{ env "NITTER_HLS_PLAYBACK" }} hlsPlayback = {{ env "NITTER_HLS_PLAYBACK" }}
{{- end }}
{{- if env "NITTER_INFINITE_SCROLL" }}
infiniteScroll = {{ env "NITTER_INFINITE_SCROLL" }} infiniteScroll = {{ env "NITTER_INFINITE_SCROLL" }}
{{- end }}