Feature Request: Exception or Warning on Duplicate Configuration Items
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
Start by tracing how py-dotenv handles repeated keys while loading a .env file and review the proposed behavior options. Done should be defined by an agreed API and semantics for warning, strict, latter-covers, and any custom merge logic.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Currently, py-dotenv uses a strategy of overwriting with the latter value when handling configuration items with the same key, that is, using the last value of the repeated key. However, I just wasted an entire morning because there were three configuration items with the same key in my .env file. 😢
To avoid others encountering similar issues, I propose adding an optional behavior parameter. The default should be warning, meaning the latter value overwrites the former but with a warning. It could also be set to strict, which throws an exception, or to latter-covers, which means the latter value overwrites the former without any warning.
I have researched how other libraries handle this issue, for reference:
| Parser | Duplicate Handling | Notes |
|---|---|---|
| Node.js dotenv | Latter covers | Most common mode |
| Python dotenv | Latter covers | Configurable to override system variables |
| PHP phpdotenv | Default error | Can be set to allow overrides |
| Ruby dotenv | Latter covers | Issues a warning |
| Go godotenv | Latter covers | No warning |
| Docker Compose | Latter covers | Follows file loading order |
Append: maybe a Callable[[list[str]], str] like sum is also acceptable, for #374 suggests a customed merge logic.
- Vorherrschende Sprache
- Python
- Sterne
- 8.9k
- Forks
- 581
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus theskumar/python-dotenv
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
theskumar/python-dotenv#699 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 35/100
theskumar/python-dotenv#697 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 28/100
theskumar/python-dotenv#693 · 1 Kommentar ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
theskumar/python-dotenv#683 · 4 Kommentare ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
theskumar/python-dotenv#644 · 2 Kommentare ·
Alle Issues in theskumar/python-dotenv
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
zostera/django-bootstrap4#894 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
use-agent-os/agent-os#3276 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
NousResearch/hermes-agent#117848 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
zilliztech/memsearch#759 ·