fix: preserve ROUTATIC_PROXY_* env vars in launchd autostart - #125
Conversation
The launchd plist template only preserved PATH, so ROUTATIC_PROXY_* environment variables (like ROUTATIC_PROXY_API_KEY) were lost when the proxy restarted on login. This caused the autostarted proxy to fail because it couldn't find the API key. Now all ROUTATIC_PROXY_* vars from the current environment are written into the plist's EnvironmentVariables dict so the proxy starts correctly after a reboot.
Code Review Roast 🔥Verdict: No Issues Found | Recommendation: Merge Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything. 📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are. Files Reviewed (2 files)
Previous Review Summary (commit d13ef67)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit d13ef67)Verdict: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)
🏆 Best part: The test fix is honest — they caught that the test was claiming 💀 Worst part: Inserting unescaped user-controlled strings into XML with 📊 Overall: Like ordering pizza and only getting the box. You got a box of XML. But where's my actual env var validation? Files Reviewed (2 files)
Reviewed by step-3.7-flash · Input: 59.9K · Output: 8.6K · Cached: 160.6K Review guidance: REVIEW.md from base branch |
text/template does not escape XML special characters, so a stray &, <, or > in an env var value would produce invalid plist XML. Added xmlEscape template function using html.EscapeString. Also added test coverage verifying ROUTATIC_PROXY_* vars with special characters are properly escaped in the generated plist.
|
All issues addressed:
All 8 daemon tests pass. |
What
The launchd plist generated by
autostart enabledidn't include environment variables. When the proxy was started via launchd (e.g., at login), it would launch withoutROUTATIC_PROXY_API_KEYand other configuration from the user's environment.Fix
Added
ExtraEnvto the plist template and populate it from the current process environment, filtering forROUTATIC_PROXY_*variables.Testing
autostart enable