Config: a single CALDAV_* variable makes the config file be ignored
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- developer-experience
Hướng nghiên cứu
Start in caldav/config.py: get_connection_params() returns the CALDAV_* environment as soon as one connection key is present, and read_config() calls yaml.load with yaml.Loader near line 108. Then check get_calendars() in caldav/base_client.py near line 1069, which calls get_davclient(check_config_file=False). Done when env values override the selected file section key by key, an env URL still wins, the search order matches docs/source/configfile.rst, and yaml.safe_load is used. Item 2 needs a maintainer decision on which order to keep.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Disclaimer: AI-generated text below the line, generated by Claude Opus 5.5 (Claude Code), from the prompts:
Please check how the caldav implementation works today. [the config-file handling, while working on https://github.com/pycalendar/calendaring/blob/main/docs/design/CONFIGURATION_PROPOSAL.md]
Please file an issue about the config inconsistencies in the caldav library
Found while specifying the shared config file for calendaring (CONFIGURATION_PROPOSAL.md), checked against master 0f2ee414.
1. Environment variables replace the config file instead of overriding it
get_connection_params() (caldav/config.py) returns the CALDAV_* environment as soon as there is one connection key in it, without merging it with the file. So a user who keeps the password out of the file:
# ~/.config/caldav/calendar.yaml
default:
caldav_url: https://dav.example.com/
caldav_username: alice
CALDAV_PASSWORD=secret python -c 'from caldav.config import get_connection_params; print(get_connection_params())'
# {'password': 'secret'}
gets no URL at all, and get_davclient() then returns a client with the URL https://.
get_calendars() does the same for a multi-section name: it calls get_davclient(check_config_file=False, …) first (caldav/base_client.py, around line 1069), so any CALDAV_* connection variable replaces a config_section="*" or contains: expansion with one env-only client.
calendaring-jmap does what one would expect: an env URL means the file is not read, otherwise the env values override the file key by key.
Suggested fix: if the environment holds a URL, keep today's behaviour; otherwise apply the env values on top of the selected section. For a name that expands to several sections, apply only an env URL (one connection replacing the expansion), and ignore the other env values.
2. The documented search order differs from the code
docs/source/configfile.rst lists /etc/caldav/calendar.conf before /etc/calendar.conf; read_config() tries /etc/calendar.conf first. One of them should change (the code order is probably what users have now).
3. YAML is parsed with yaml.Loader
read_config() uses yaml.load(config_file, yaml.Loader) (caldav/config.py line 108), which constructs arbitrary Python objects from tags. Config files are searched in /etc/ too, and will be shared with other pycalendar tools. yaml.safe_load would do; nothing in the documented format needs tags.
- Ngôn ngữ chính
- Python
- Star
- 412
- Fork
- 113
- Merge trung bình
- 22 giờ 43 phút
- Pull request đã merge (30 ngày)
- 43
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc 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 python-caldav/caldav
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
python-caldav/caldav#687 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
python-caldav/caldav#784 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
python-caldav/caldav#783 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
python-caldav/caldav#782 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
compatibility refactoring
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
python-caldav/caldav#778 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của python-caldav/caldav
Issue tương tự
-
Examples say cnxĐang mởdocumentation embedded
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Alishahryar1/free-claude-code#2111 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
namespace operations
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
EclipseFdn/open-vsx.org#14373 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày