fix: load env before config

This commit is contained in:
h
2026-05-21 00:32:00 +02:00
parent 3dc780c74c
commit 94bae38012
+9
View File
@@ -27,6 +27,7 @@ from typing import TYPE_CHECKING
import uvicorn
import uvloop
from dotenv import load_dotenv
from raycast_api import Client as RaycastClient
from raycast_api.config import Config as RaycastConfig
@@ -61,6 +62,14 @@ def main() -> None:
async def _async_main() -> None:
# Populate ``os.environ`` from ``.env`` before anything else so the
# user's ``config.py`` can read its own secrets via ``os.environ[...]``
# (Firefly PAT, third-party MCP creds, etc.). ``Settings`` already
# reads ``.env`` independently via pydantic-settings, but that path
# populates Settings fields, not the process environment.
# ``override=False``: real env vars (Docker, systemd) win over .env.
load_dotenv(override=False)
settings = Settings() # ty: ignore[missing-argument]
gateway = config_loader.load(settings.config_path)