fix: load env before config
This commit is contained in:
@@ -27,6 +27,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import uvicorn
|
import uvicorn
|
||||||
import uvloop
|
import uvloop
|
||||||
|
from dotenv import load_dotenv
|
||||||
from raycast_api import Client as RaycastClient
|
from raycast_api import Client as RaycastClient
|
||||||
from raycast_api.config import Config as RaycastConfig
|
from raycast_api.config import Config as RaycastConfig
|
||||||
|
|
||||||
@@ -61,6 +62,14 @@ def main() -> None:
|
|||||||
|
|
||||||
|
|
||||||
async def _async_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]
|
settings = Settings() # ty: ignore[missing-argument]
|
||||||
gateway = config_loader.load(settings.config_path)
|
gateway = config_loader.load(settings.config_path)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user