Feature Request: Exception or Warning on Duplicate Configuration Items
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 8.9k
- Fork
- 581
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của theskumar/python-dotenv
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
theskumar/python-dotenv#699 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
theskumar/python-dotenv#697 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 28/100
theskumar/python-dotenv#693 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
theskumar/python-dotenv#683 · 4 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
theskumar/python-dotenv#644 · 2 bình luận ·
Tất cả issue của theskumar/python-dotenv
Issue tương tự
-
area/auth bug comp/agent P3 platform/discord type/security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
NousResearch/hermes-agent#117848 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
bancolombia/sentinel#23 ·
-
test md Đang mởCI
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100