symfony: How to set configuration parameters files for different environments?

百般思念 提交于 2019-12-08 20:16:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!