📄 dotenv.cpython-312.pyc
/home/palash/git/local-ai/server/__pycache__/dotenv.cpython-312.pyc
Language: pyc • Lines: 44
�

�K�j#��2�dZddlZddlmZdd�Ze�y)u�Minimal ``.env`` loader (stdlib only — no external dependency).

Reads a ``KEY=VALUE`` file from the repo root into ``os.environ`` so every
entrypoint (``chat-webui.py``, ``self-chat.py``, ``markdown_hosting.py``)
sees the same settings whether it is launched by hand, systemd or cron.

Only values that are NOT already exported by the real environment are applied,
so a systemd ``EnvironmentFile`` or the shell always wins over the ``.env``.
�N)�Pathc�T�|�4tt�j�jjdz}t|�}|j	�syd}|j�j
�D]�}|j�}|r|jd�sd|vr�+|jd�\}}}|j�}|j�}|s�ct|�dk\r|d|dk(r|ddvr|d	d}|s��|tjvs��|tj|<d
}��|S)z@Load ``path`` (default: repo-root ``.env``) into ``os.environ``.z.envF�#�=�r�����)�'�"�T)
r�__file__�resolve�parent�is_file�	read_text�
splitlines�strip�
startswith�	partition�len�os�environ)�path�loaded�raw�line�key�_�values       �*/home/palash/git/local-ai/server/dotenv.py�load_dotenvr s���|��H�~�%�%�'�.�.�5�5��>����:�D��<�<�>��
�F��~�~��*�*�,�
���y�y�{���t���s�+�s�$������s�+�
��Q���i�i�k�����
�����u�:��?�u�Q�x�5��9�4��q��Z�9O��!�B�K�E��3�b�j�j�(�#�B�J�J�s�O��F�
��M�)N)�__doc__r�pathlibrr �r!r�<module>r%s���
���2�
r!