Files
Stirling-PDF/engine/scripts/setup_env.py
T
James BruntonandGitHub 3b2afe0deb Change engine/.env to be committed and have .env.local override (#6150)
# Description of Changes
We keep adding stuff to `engine/config/.env.example` and have to
manually update `.env` because of it, which is really clunky, especially
when working on multiple worktrees at once. This PR changes it so that
we just have a committed `.env` file and have an `.env.local` override
to put the actual private keys into, which should make it a bit easier
to manage.

> [!warning]
>
> After this goes in, be very careful for a little while not to
accidentally commit any keys that you've got inside your `.env` file!
2026-04-21 16:18:25 +01:00

25 lines
778 B
Python

"""
Ensures `.env.local` exists so developers have a place to put overrides
(API keys, local model choices, etc.) without touching the committed `.env`.
Usage:
uv run scripts/setup_env.py
"""
from pathlib import Path
ROOT = Path(__file__).parent.parent
ENV_LOCAL_FILE = ROOT / ".env.local"
TEMPLATE = """\
###############################################################################
# Local overrides for `engine/.env`
# Put API keys and machine-specific settings here. Any variable defined here
# takes precedence over the committed `.env`
###############################################################################
"""
if not ENV_LOCAL_FILE.exists():
ENV_LOCAL_FILE.write_text(TEMPLATE)
print("setup-env: created empty .env.local for local overrides")