📌 Description
internal/config/dotenv.go (51 lines) parses .env files for local/dev config loading. If it currently skips malformed lines (e.g. missing =, stray quotes) without any warning, a typo in an env var silently results in that variable being unset rather than failing fast — which then surfaces as a confusing downstream error in internal/config/config.go.
🧩 Requirements and context
- Inspect current parsing behavior for malformed lines and decide fail-fast vs warn-and-skip (recommend: warn loudly via stderr/logger, since this only affects local dev).
- Add a test for common malformation cases: missing
=, unterminated quote, duplicate key, comment-only line, empty file.
- Ensure the existing valid-parsing behavior is unchanged.
Non-functional requirements
- Must be secure, tested, and documented.
- Should be efficient and easy to review.
🛠️ Suggested execution
1. Fork the repo and create a branch
git checkout -b fix/dotenv-malformed-line-warning
2. Implement changes
- Modify:
internal/config/dotenv.go — add malformed-line detection and a clear warning log.
- Add test:
internal/config/config_test.go (or a new dotenv_test.go) covering the malformation cases.
3. Test and commit
go test ./internal/config/... -v
- Cover edge cases: missing equals sign, unterminated quote, duplicate key (last-wins vs first-wins), Windows line endings (CRLF).
- Include test output and details in the PR description.
Example commit message
fix: warn on malformed .env lines instead of silently skipping them
✅ Acceptance criteria
🔒 Security notes
Low direct security impact (dev-only tooling), but a silently-dropped JWT_SECRET or similar could lead to a weak/default value being used unnoticed — validate no sensitive default is used as a fallback.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
internal/config/dotenv.go(51 lines) parses.envfiles for local/dev config loading. If it currently skips malformed lines (e.g. missing=, stray quotes) without any warning, a typo in an env var silently results in that variable being unset rather than failing fast — which then surfaces as a confusing downstream error ininternal/config/config.go.🧩 Requirements and context
=, unterminated quote, duplicate key, comment-only line, empty file.Non-functional requirements
🛠️ Suggested execution
1. Fork the repo and create a branch
2. Implement changes
internal/config/dotenv.go— add malformed-line detection and a clear warning log.internal/config/config_test.go(or a newdotenv_test.go) covering the malformation cases.3. Test and commit
go test ./internal/config/... -vExample commit message
✅ Acceptance criteria
.envfiles parse identically to before.🔒 Security notes
Low direct security impact (dev-only tooling), but a silently-dropped
JWT_SECRETor similar could lead to a weak/default value being used unnoticed — validate no sensitive default is used as a fallback.📋 Guidelines