mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 18:44:05 +02:00
# 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!
25 lines
778 B
Python
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")
|