Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.env: Make MAILER_URL and DATABASE_URL consistent #30316

Closed
ThomasLandauer opened this issue Feb 20, 2019 · 4 comments
Closed

.env: Make MAILER_URL and DATABASE_URL consistent #30316

ThomasLandauer opened this issue Feb 20, 2019 · 4 comments

Comments

@ThomasLandauer
Copy link
Contributor

Description
Use either the form username:password@server or server?username=&password= for all connection url strings in .env

https://symfony.com/doc/current/doctrine.html#configuring-the-database says

DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name"

whereas https://symfony.com/doc/current/email.html#configuration says

MAILER_URL=smtp://localhost:25?encryption=ssl&auth_mode=login&username=&password=

And (weirdly enough), the .env.dist file itself contains this example:

For Gmail as a transport, use: "gmail://username:password@localhost"

So I'm suggesting to make it consistent for all!

Besides, how to escape special characters should be explained better. https://symfony.com/doc/current/doctrine.html#configuring-the-database has a dedicated alert box about this, https://symfony.com/doc/current/email.html#configuration just has a comment in the code. So I'd suggest to copy the alert box to the email docs as well. Should I do that?

Is the parsing of the .env file done per package or centrally? If centrally, then maybe the escaping question should rather be explained at https://symfony.com/doc/current/components/dotenv.html ?

@xabbuh
Copy link
Member

xabbuh commented Feb 20, 2019

Well, the issue is that these URLs are interpreted by different systems which follow different formats. To be able to have a universal format would mean that we would have to somewhere transform them which will probably sooner or later lead to confusion when the format used here does not match the format used in the documentation of the used libraries.

@ThomasLandauer
Copy link
Contributor Author

OK, thanks, so it's not done centrally ;-)

What about opening an issue at Doctrine bundle or Swiftmailer bundle to change the format? Which format would you say is better: username:password@server or server?username=&password=?

Any why didn't the guys who invented this, make it consistent in the first place? ;-)

@nicolas-grekas
Copy link
Member

Any why didn't the guys who invented this, make it consistent in the first place? ;-)

because separate individuals don't share the same brain ;) If you think this should be done, I think you should send a PR. That's the best way to prove your point, as always in OSS ;)

@ThomasLandauer
Copy link
Contributor Author

I updated the Swift Mailer docs about the special characters: symfony/symfony-docs#11054

And I suggested to change the syntax in Swift Mailer Bundle: symfony/swiftmailer-bundle#276
Main reasons for suggesting Swift Mailer to adopt Doctrine's syntax (and not vice versa):

  • Swift Mailer is inconsistent in itself, since it's already using the Doctrine syntax for gmail://.
  • The Doctrine syntax has (some) RFC support.

So I'm closing this.

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

No branches or pull requests

3 participants