The website bot status tab was replaced by the VEGA status page, so nothing reads sysinfo/server anymore. get_db() stays for calendar and bucketlist. Co-Authored-By: Claude Opus 5.5 <[email protected]>
27 lines
808 B
Python
27 lines
808 B
Python
"""Firebase project config + shared Admin SDK client."""
|
|
######################################################################
|
|
import logging
|
|
import os
|
|
|
|
from google.cloud.firestore import AsyncClient
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
PROJECT_ID = "esef-514bf"
|
|
|
|
_db: AsyncClient | None = None
|
|
|
|
|
|
def get_db() -> AsyncClient:
|
|
"""Return the shared Firestore AsyncClient, creating it on first call."""
|
|
global _db
|
|
if _db is None:
|
|
if not os.getenv("GOOGLE_APPLICATION_CREDENTIALS"):
|
|
raise RuntimeError(
|
|
"GOOGLE_APPLICATION_CREDENTIALS is not set. "
|
|
"Point it to your service-account JSON file."
|
|
)
|
|
_db = AsyncClient(project=PROJECT_ID)
|
|
log.info("Firestore Admin SDK initialised (project %s)", _db.project)
|
|
return _db
|