import os import auto_register from waitress import serve from server import app, acm, UPSTREAM_URL, RITA_ORIGIN, log HOST = os.getenv("HOST", "0.0.0.0") PORT = int(os.getenv("PORT", "7860")) if __name__ == "__main__": s = acm.summary() print("\n" + "=" * 60) print("🚀 rita2api starting (Waitress)") print(f"📍 Port: {PORT} Upstream: {UPSTREAM_URL}") print(f"🔑 Accounts: {s['total']} total, {s['active']} active, {s['disabled']} disabled") print(f"🌐 WebUI: http://localhost:{PORT}/") print("=" * 60 + "\n") acm.start_health_checker(UPSTREAM_URL, RITA_ORIGIN, log_fn=log) auto_register.start_auto_replenish(acm, UPSTREAM_URL, RITA_ORIGIN, log_fn=log) serve(app, host=HOST, port=PORT, threads=8)