o
    i%                     @  sV   d Z ddlmZ ddlZddlmZ ddlmZ ee	 j
j
j
Zej
Zd
dd	ZdS )u  Stable .env loading for MCube and agent_runtime processes.

Historically, modules used ``load_dotenv(".env.local")``, which only works when the
process cwd is ``agent_runtime/``. This module loads from fixed paths:

1. ``backend/.env`` — same file Django uses (shared secrets / MCube vars)
2. ``backend/agent_runtime/.env.local`` — optional overrides (wins on duplicate keys)

Set ``AGENT_RUNTIME_ENV_FILE`` to an absolute path to load only that file
(``override=True``), for ad-hoc testing.
    )annotationsN)Path)load_dotenvreturnNonec                  C  sL   t dd } | rtt| dd d S ttd dd ttd dd d S )NAGENT_RUNTIME_ENV_FILE T)overridez.envFz
.env.local)osgetenvstripr   r   _BACKEND_ROOT_AGENT_RUNTIME_ROOT)explicit r   S/var/www/html/livekitdocker/backend/agent_runtime/src/mcube_integration/env_load.pyload_agent_runtime_dotenv   s   r   )r   r   )__doc__
__future__r   r
   pathlibr   dotenvr   __file__resolveparentr   r   r   r   r   r   r   <module>   s    