circular import issue

This commit is contained in:
esef committed 2026-07-13 12:21:53 +03:00
1 parent c66195d4cd
commit d935ebe8fb
3 files changed
+27 -29

No files matched your search

+24 -3
View File
@@ -1,7 +1,28 @@
"""Firebase project config — shared by all website integrations."""
"""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"
SYSINFO_INTERVAL = 10 # seconds between pushes
# How often system stats are pushed (seconds)
SYSINFO_INTERVAL = 10
_db: AsyncClient | None = None
def get_db() -> AsyncClient:
"""Return the shared Firestore AsyncClient, creating it on first call."""
global _db
if _db is None:
creds_path = os.getenv("GOOGLE_APPLICATION_CREDENTIALS")
if creds_path is None:
raise RuntimeError(
"GOOGLE_APPLICATION_CREDENTIALS is not set. "
"Point it to your service-account JSON file."
)
_db = AsyncClient()
log.info("Firestore Admin SDK initialised (project %s)", _db.project)
return _db