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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use environment variables for app config #605

Closed
wants to merge 1 commit into from

Conversation

aschempp
Copy link
Member

This allows to use .env files for the application configuration, as is best practice in Symfony.

FYI

  • If the env variable is not set, the old parameters are still applied, so there should be full BC
  • That also means the install tool does not need to be updated
  • The Contao API already provides support for reading + writing the .env variables, so the Manager would already be able to configure the database connection 馃槑

@aschempp aschempp added this to the 4.9 milestone Jul 24, 2019
@aschempp aschempp self-assigned this Jul 24, 2019
@@ -1,5 +1,7 @@
# Default parameters
parameters:
env(APP_SECRET): '%secret%'
env(DATABASE_URL): 'mysql://%database_user%:%database_password%@%database_host%:%database_port%/%database_name%'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have a database URL, we do not need the database_* parameters anymore, do we?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need them for backwards compatibility and the install tool

@aschempp
Copy link
Member Author

aschempp commented Aug 5, 2019

Btw this also means we no longer need to re-compile the container when changing database credentials (which does not apply to the install tool yet though)! 馃槑

@leofeyer
Copy link
Member

This concept does not work for the mailer URL though:

A string value must be composed of strings and/or numbers, but found parameter "mailer_user" of type NULL inside string value "%mailer_transport%://%mailer_host%:%mailer_port%?username=%mailer_user%&password=%mailer_password%&encryption=%mailer_encryption%"

@leofeyer
Copy link
Member

Ah, it does not work for the database URL, either:

A string value must be composed of strings and/or numbers, but found parameter "database_user" of type NULL inside string value "mysql://%database_user%:%database_password%@%database_host%:%database_port%/%database_name%"

@aschempp
Copy link
Member Author

The mailer might be an issue because some parameters are optional. But that's not the case for the database, how can database_user be NULL for you?

@leofeyer
Copy link
Member

See #768.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants