Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

Move %locale% to config.yml #776

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ imports:
- { resource: security.yml }
- { resource: services.yml }

# Put parameters here that don't need to change on each machine where the app is deployed
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
locale: en
Copy link
Member

Choose a reason for hiding this comment

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

I would also move the database_driver here. You don't change the database driver on each machine

Choose a reason for hiding this comment

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

That makes sense, I like the idea of moving that as well.
One minor concern to think about: Do you think that harms the getting-started experience for new users with a different environment set-up?

Copy link

Choose a reason for hiding this comment

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

@MaxvanderVelde good point, I think we have to make the distinction between 2 kinds of install:

  • creation of a project
  • installation of a created project

The first one is what the symfony installer should take care of, and it includes this kind of parameters.
The second one is what the Incenteev ParameterHandler takes care of, and it includes the parameters like database username and password.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree database_driver should be moved as well to be correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if database_driver really should be a parameter at all then.

Copy link
Member

Choose a reason for hiding this comment

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

I generally configure it directly indeed

Copy link
Contributor

Choose a reason for hiding this comment

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

Same, if it's considered as app-relative, having it directly in parameters might be useless.
By the way, maybe it can break BC, depending whether it's merged in master or 2.6/7 ? I don't know if this parameter is used elsewhere by service or conf, etc.

Copy link
Member

Choose a reason for hiding this comment

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

+1 for removing the database_driver parameter altogether and configuring it directly. It should make using sqlite a little bit easier I think anyways. I don't think this is a BC break, since the SE is just for new projects (and nothing internally currently uses the database_driver parameter anyways).

So, let's do it!

Copy link
Member

Choose a reason for hiding this comment

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

+1 for moving the database_driver as well.


framework:
#esi: ~
#translator: { fallback: "%locale%" }
Expand Down Expand Up @@ -46,7 +51,7 @@ assetic:
# Doctrine Configuration
doctrine:
dbal:
driver: "%database_driver%"
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
Expand Down
5 changes: 2 additions & 3 deletions app/config/parameters.yml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This file is a "template" of what your parameters.yml file should look like
# Set parameters here that may be different on each deployment target of the app, e.g. development, staging, production.
# http://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
parameters:
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port: ~
database_name: symfony
Expand All @@ -14,7 +15,5 @@ parameters:
mailer_user: ~
mailer_password: ~

locale: en

# A secret key that's used to generate certain security-related tokens
secret: ThisTokenIsNotSoSecretChangeIt
Copy link
Contributor

Choose a reason for hiding this comment

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

As we discussed in symfony/symfony#14026 the secret MUST NOT be different for each machine. So this stays in contrast to the added comment at the top of the file.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks Tobion - I see the comment here: symfony/symfony#14026 (comment)

I don't think this should hold up this PR, though - I think moving the secret somewhere else should be a different issue.

Copy link
Member

Choose a reason for hiding this comment

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

@Tobion the secret must be the same for all server of a given deployment setup (i.e. all your prod servers). they need to share the secret. but it is the same for all other settings (if each prod server use a different DB, it could create weird stuff).
The secret should however be different for each deployment setup (your prod vs your preprod)

Copy link
Contributor

Choose a reason for hiding this comment

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

correct, then I would suggest to rephrase the comment to "Set parameters here that may be different on each deployment target of the app, e.g. development, staging, production."

Copy link
Member

Choose a reason for hiding this comment

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

👍 for updating it to that exact wording