Feature Request: Exception or Warning on Duplicate Configuration Items
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 8.9k
- フォーク
- 581
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
theskumar/python-dotenv のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
theskumar/python-dotenv#699 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
theskumar/python-dotenv#697 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 28/100
theskumar/python-dotenv#693 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
theskumar/python-dotenv#683 · コメント 4 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
theskumar/python-dotenv#644 · コメント 2 件 ·
theskumar/python-dotenv の issue をすべて見る
似ている issue
-
link-check link-check:sphinx-theme
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
OpenHands/extensions#626 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
CSCfi/sd-search-api#39 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100