File size: 750 Bytes
c6393bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)