Adds `python -m app --check` which verifies: - All required environment variables are set - Matrix homeserver is reachable - Bot access token is valid - Bot is a member of the announcements room - Database path is writable Uses color-coded pass/fail output with actionable hints on failure. Configures nio with a 10-second timeout and no retries so checks complete quickly even against unreachable servers. https://claude.ai/code/session_01DuzWyMMXvLMB4VxEwJyV4X
36 lines
748 B
Python
36 lines
748 B
Python
"""CLI entry point for Melora.
|
|
|
|
Usage:
|
|
python -m app --check Verify configuration and connectivity
|
|
python -m app Start the server
|
|
"""
|
|
|
|
import argparse
|
|
import sys
|
|
|
|
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser(
|
|
prog="melora",
|
|
description="Melora — *arr media arrival webhook bridge for Matrix",
|
|
)
|
|
parser.add_argument(
|
|
"--check",
|
|
action="store_true",
|
|
help="verify configuration and connectivity, then exit",
|
|
)
|
|
args = parser.parse_args()
|
|
|
|
if args.check:
|
|
from app.check import run_checks
|
|
|
|
raise SystemExit(run_checks())
|
|
|
|
import uvicorn
|
|
|
|
uvicorn.run("app.main:app", host="0.0.0.0", port=8000)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|