diff --git a/README.md b/README.md index 4537db7..d46e993 100644 --- a/README.md +++ b/README.md @@ -415,7 +415,7 @@ Issues and pull requests are welcome. Two house rules before you send a patch: 1. **Open an issue first for anything beyond a typo** — this is a small, opinionated tool and the maintainer would rather agree on the shape before you write it. 2. **Do not break the tests.** `python test_pagination.py` must pass, and new behaviour wants a check added to it. -Please never commit credentials, host names or personal URLs. The repo intentionally ships no default base id, token or chat id. +Please never commit credentials, host names or personal URLs. The repo ships no base id, token or chat id — `NOCODB_BASE_ID` and `NOCODB_TOKEN` are required settings and the monitor refuses to start (with a clear message) until they are set. ## Credits diff --git a/docker-compose.yml b/docker-compose.yml index 68c6863..157e0a3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,7 +14,7 @@ services: environment: NOCODB_URL: ${NOCODB_URL:-http://nocodb:10380} NOCODB_TOKEN: ${NOCODB_TOKEN} - NOCODB_BASE_ID: ${NOCODB_BASE_ID:-poqw1zjw3hnsk37} + NOCODB_BASE_ID: ${NOCODB_BASE_ID} TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN} TELEGRAM_CHAT_ID: ${TELEGRAM_CHAT_ID} TICK_SECONDS: ${TICK_SECONDS:-60} diff --git a/monitor.py b/monitor.py index 92d649f..44d73bf 100644 --- a/monitor.py +++ b/monitor.py @@ -31,7 +31,7 @@ import urllib.request # --------------------------------------------------------------------------- # NOCODB_URL = os.environ.get("NOCODB_URL", "http://nocodb:10380").rstrip("/") NOCODB_TOKEN = os.environ.get("NOCODB_TOKEN", "") -NOCODB_BASE_ID = os.environ.get("NOCODB_BASE_ID", "poqw1zjw3hnsk37") +NOCODB_BASE_ID = os.environ.get("NOCODB_BASE_ID", "") TELEGRAM_BOT_TOKEN = os.environ.get("TELEGRAM_BOT_TOKEN", "") TELEGRAM_CHAT_ID = os.environ.get("TELEGRAM_CHAT_ID", "") DATA_DIR = os.environ.get("DATA_DIR", "/data") @@ -866,9 +866,12 @@ def run_tick(listings_tid, settings_tid, ignored_sellers_tid, ignored_keywords_t def main(): - if not NOCODB_TOKEN: - sys.stderr.write("NOCODB_TOKEN not set\n") - write_health(False, "NOCODB_TOKEN not set") + if not NOCODB_TOKEN or not NOCODB_BASE_ID: + missing = ", ".join(n for n, v in (("NOCODB_TOKEN", NOCODB_TOKEN), + ("NOCODB_BASE_ID", NOCODB_BASE_ID)) + if not v) + sys.stderr.write(f"{missing} not set\n") + write_health(False, f"{missing} not set") sys.exit(2) (listings_tid, settings_tid, ignored_sellers_tid, ignored_keywords_tid,