Skip to content

fix(config): fall back to ~/.config/pup/config.yaml on macOS#538

Merged
platinummonkey merged 2 commits into
mainfrom
claude/issue-537-ew7mU
May 29, 2026
Merged

fix(config): fall back to ~/.config/pup/config.yaml on macOS#538
platinummonkey merged 2 commits into
mainfrom
claude/issue-537-ew7mU

Conversation

@platinummonkey
Copy link
Copy Markdown
Collaborator

Summary

On macOS, dirs::config_dir() returns ~/Library/Application Support rather than ~/.config, so ~/.config/pup/config.yaml (the path documented throughout the project) was silently ignored. This PR makes that path work as a fallback on macOS.

Changes

  • src/config.rs: Add config_file_candidates() that returns config.yaml paths to try in priority order. On macOS, appends ~/.config/pup/config.yaml as a second candidate — but only when PUP_CONFIG_DIR is not set, so explicit overrides remain fully respected. (config.rs:276-297)
  • src/config.rs: Update load_config_file() to iterate candidates via find_map instead of reading a single path. (config.rs:299-305)
  • src/config.rs: Add four new tests: primary path is always first candidate, macOS XDG fallback is included, PUP_CONFIG_DIR suppresses XDG fallback, and config values flow through Config::from_env().
  • docs/ARCHITECTURE.md: Document the platform-specific config file locations.

Testing

  • test_config_file_candidates_includes_primary — platform-independent: PUP_CONFIG_DIR path is first candidate
  • test_config_file_candidates_macos_includes_xdg_fallback — macOS-only: XDG path appears in candidates
  • test_config_file_candidates_macos_pup_config_dir_suppresses_xdg — macOS-only: explicit override suppresses fallback
  • test_load_config_from_primary_path — end-to-end: site from config.yaml is picked up by Config::from_env()

Related Issues

Closes #537


Generated by Claude Code

On macOS, dirs::config_dir() returns ~/Library/Application Support, not
~/.config. This caused config.yaml to be silently ignored when placed at
the cross-platform path documented throughout the project.

- Add config_file_candidates() that returns paths to try in priority
  order; on macOS (and only when PUP_CONFIG_DIR is not set), the
  XDG-style ~/.config/pup/config.yaml is appended as a fallback
- Update load_config_file() to iterate candidates rather than read a
  single path
- Add tests covering: primary path loaded, macOS XDG fallback present,
  PUP_CONFIG_DIR suppresses XDG fallback, config values applied via
  Config::from_env()
- Update ARCHITECTURE.md to document platform-specific config paths

Fixes #537

Co-Authored-By: Claude <noreply@anthropic.com>
@platinummonkey platinummonkey requested a review from a team as a code owner May 29, 2026 05:13
@datadog-datadog-prod-us1-2

This comment has been minimized.

@platinummonkey platinummonkey merged commit 43c0d17 into main May 29, 2026
6 checks passed
@platinummonkey platinummonkey deleted the claude/issue-537-ew7mU branch May 29, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

config.yaml silently ignored on macOS — ~/.config path is Linux-only

2 participants