fix/config: parse env_files with the dotenv convention #64
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/config-dotenv-env-files"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
env_files were parsed literally, so SONARQUBE_TOKEN with surrounding double quotes reached the upstream MCP server with the quotes included and failed auth with Not authorized, which cost an hour of debugging today. resolveEnv now follows the dotenv convention: an optional leading export prefix is stripped, matching single or double quotes are removed from values, inside double quotes only the three escapes backslash-quote, backslash-backslash and backslash-n are processed while single quotes stay fully literal, an unquoted trailing hash comment preceded by whitespace is dropped, a leading UTF-8 BOM is ignored, and a line without an equals sign or with an empty name is now an error naming the file and line number, never the line content, instead of being skipped silently. Inline env still overrides file values. Covered by table-driven tests in internal/config/envfile_test.go including CRLF files and a sentinel test proving parse errors never echo a credential, mutation-checked by the reviewer. Docs: a format table in docs/configuration.qmd and an Unreleased changelog entry with an upgrade note, since existing files with trailing comments or quotes change meaning. Follow-up not in this PR: wraptool doctor still only checks that env files exist and have tight permissions, it does not parse them. 🤖 Generated with Claude Code