Skip to content

fix: move inline comments above env vars in .env.local.example - #251

Open
tturnerdev wants to merge 1 commit into
litestar-org:mainfrom
tturnerdev:fix/env-inline-comments
Open

fix: move inline comments above env vars in .env.local.example#251
tturnerdev wants to merge 1 commit into
litestar-org:mainfrom
tturnerdev:fix/env-inline-comments

Conversation

@tturnerdev

Copy link
Copy Markdown
Contributor

Summary

  • Inline comments after = in .env files are parsed as part of the value by most env parsers (python-dotenv, shell source, etc.)
  • This caused EMAIL_SMTP_USER to resolve to # Mailpit doesn't require auth, leave empty for dev instead of an empty string
  • The truthy value triggered smtp.login() against Mailpit, which doesn't support SMTP AUTH without TLS, resulting in: EmailConnectionError: SMTP connection error: The SMTP AUTH extension is not supported by this server
  • Moved all inline comments in the email configuration section to the line above their respective variables

Test plan

  • Copy .env.local.example to .env
  • Start the app with Mailpit running
  • Trigger an email (e.g., team invitation)
  • Verify email is sent successfully without SMTP AUTH errors

🤖 Generated with Claude Code

@tturnerdev
tturnerdev requested review from a team and cofin as code owners April 28, 2026 03:16
@tturnerdev
tturnerdev force-pushed the fix/env-inline-comments branch from 7f7d760 to 65da09d Compare April 28, 2026 03:23
Inline comments after `=` in .env files are not treated as comments by
most parsers — the text after the value (including the `#`) is parsed
as part of the value itself. This caused SMTP authentication failures
with Mailpit because `EMAIL_SMTP_USER` resolved to the comment string
rather than an empty value, triggering an unwanted `smtp.login()` call.

Move all inline comments to the line above their respective variables.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tturnerdev
tturnerdev force-pushed the fix/env-inline-comments branch from 65da09d to 6ad281e Compare April 28, 2026 03:27
@sonarqubecloud

Copy link
Copy Markdown

@tturnerdev

Copy link
Copy Markdown
Contributor Author

PR made with help of AI; fully reviewed and verified by me.

Some additional details:

  • Issue resulted from env file copied directly from .env.local.example

Application environment details:

  • App running in python venv, using VITE_DEV_MODE=true, and launching with uv run app run
  • Supporting infra is running via default, provided Docker image

Otherwise, fully stock set up. The SMTP errors began immediately after adding EMAIL_BACKEND=smtp.

Before this, emails were not working at all and I had to copy the sign-up URL token directly from the logs (or edit the user in db to set to "verified").

After this change, I now see outgoing emails in Mailpit as expected.

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.

1 participant