mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-11 12:17:45 +02:00
[shawn] fix: load backend/.env at startup so Telegram listener gets API creds in dev
This commit is contained in:
@@ -2,8 +2,19 @@ import asyncio
|
||||
import html
|
||||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
from uuid import uuid4
|
||||
|
||||
# Load backend/.env before any module reads os.environ. Production builds
|
||||
# (DMG/EXE) get env vars injected by Electron at spawn so this is a no-op
|
||||
# there. In dev mode (`bash run.sh`) this is the only thing pulling .env
|
||||
# values into the process — OPENSWARM_TELEGRAM_API_ID, GOOGLE_OAUTH_*, etc.
|
||||
try:
|
||||
from dotenv import load_dotenv as _load_dotenv
|
||||
_load_dotenv(Path(__file__).parent / ".env")
|
||||
except Exception: # noqa: BLE001
|
||||
pass
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
from fastapi.responses import JSONResponse, HTMLResponse
|
||||
|
||||
Reference in New Issue
Block a user