问题
How to setup a different configuration parameters file for each environment?
At the moment parameters in parameters.yml
are used in both dev
and prod
environment, but I need different parameters in order to deploy my app in prod.
回答1:
You can put all the parameters used in your dev
environment in a app\config\parameters_dev.yml
file (you need to create it) and then import it in your app\config\config_dev.yml
:
imports:
- { resource: config.yml }
- { resource: parameters_dev.yml }
So when you work in local any parameter used in production will be overwritten by the new file with the right parameters.
And remember to Clear the cache!
来源:https://stackoverflow.com/questions/29328186/symfony-how-to-set-configuration-parameters-files-for-different-environments