Skip to content

Commit

Permalink
flag for debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
KTachibanaM committed Oct 15, 2024
1 parent 3be321d commit 7e9a219
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions docker-compose.self-contained.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ services:
# optional debugging flags
- DEBUG=1
- RESET_NITTER_ACCOUNTS_FILE=1
- INSTANCE_ENABLE_DEBUG=1
env_file:
# should require from env
# TWITTER_USERNAME
Expand Down
3 changes: 2 additions & 1 deletion docs/self-contained-docker-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ In addition to the [regular Nitter docker image](https://github.com/sekai-soft/n
| INSTANCE_HOSTNAME | No | The hostname used to render public-facing URLs such as hyperlinks in RSS feeds. Defaults to `localhost:8080`. |
| INSTANCE_HTTPS | No | Use `1` to enable serving https traffic. |
| DEBUG | No | Use `1` to log debug messages. |
| RESET_NITTER_ACCOUNTS_FILE | No | Use `1` to remove the existing `/nitter-data/guest_accounts.json` file |
| RESET_NITTER_ACCOUNTS_FILE | No | Use `1` to remove the existing `/nitter-data/guest_accounts.json` file |
| INSTANCE_ENABLE_DEBUG | No | Use `1` to enable debug logging |

* After the container is up, Nitter is available at port 8081 within the container if Nginx is enabled, and at port 8080 within the container if Nginx is disabled.

Expand Down
1 change: 1 addition & 0 deletions scripts/dump_env_and_procfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ echo INSTANCE_BASE64_MEDIA=$INSTANCE_BASE64_MEDIA >> /src/.env
echo INSTANCE_TITLE=$INSTANCE_TITLE >> /src/.env
echo INSTANCE_THEME=$INSTANCE_THEME >> /src/.env
echo INSTANCE_INFINITE_SCROLL=$INSTANCE_INFINITE_SCROLL >> /src/.env
echo INSTANCE_ENABLE_DEBUG=$INSTANCE_ENABLE_DEBUG >> /src/.env

echo Dumping instance guardian env...
echo INSTANCE_RSS_PASSWORD=$INSTANCE_RSS_PASSWORD >> /src/.env
Expand Down
7 changes: 5 additions & 2 deletions scripts/gen_nitter_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
BASE64_MEDIA_PLZ_CHANGE = "[BASE64_MEDIA_PLZ_CHANGE]"
THEME_PLZ_CHANGE = "[THEME_PLZ_CHANGE]"
INFINITE_SCROLL_PLZ_CHANGE = "[INFINITE_SCROLL_PLZ_CHANGE]"
ENABLE_DEBUG_PLZ_CHANGE = "[ENABLE_DEBUG_PLZ_CHANGE]"

TEMPLATE = """[Server]
hostname = "[HOSTNAME_PLZ_CHANGE]" # for generating links, change this to your own domain/ip
Expand All @@ -38,7 +39,7 @@
hmacKey = "secretkey" # random key for cryptographic signing of video urls
base64Media = [BASE64_MEDIA_PLZ_CHANGE] # use base64 encoding for proxied media urls
enableRSS = true # set this to false to disable RSS feeds
enableDebug = false # enable request logs and debug endpoints (/.accounts)
enableDebug = [ENABLE_DEBUG_PLZ_CHANGE] # enable request logs and debug endpoints (/.accounts)
proxy = "" # http/https url, SOCKS proxies are not supported
proxyAuth = ""
tokenCount = 10
Expand Down Expand Up @@ -89,6 +90,7 @@ def main() -> str:
title = getenv_treat_empty_string_as_none("INSTANCE_TITLE", "My Nitter instance")
theme = getenv_treat_empty_string_as_none("INSTANCE_THEME", "Nitter")
infinite_scroll = "true" if os.getenv("INSTANCE_INFINITE_SCROLL") == "1" else "false"
enable_debug = "true" if os.getenv("INSTANCE_ENABLE_DEBUG") == "1" else "false"

return TEMPLATE \
.replace(HOSTNAME_PLZ_CHANGE, hostname) \
Expand All @@ -100,7 +102,8 @@ def main() -> str:
.replace(BASE64_MEDIA_PLZ_CHANGE, base64_media) \
.replace(TITLE_PLZ_CHANGE, title) \
.replace(THEME_PLZ_CHANGE, theme) \
.replace(INFINITE_SCROLL_PLZ_CHANGE, infinite_scroll)
.replace(INFINITE_SCROLL_PLZ_CHANGE, infinite_scroll) \
.replace(ENABLE_DEBUG_PLZ_CHANGE, enable_debug)

if __name__ == "__main__":
if len(sys.argv) != 2:
Expand Down

0 comments on commit 7e9a219

Please sign in to comment.