Symfony: How to configure configuration settings files for different environments?

How to configure a different configuration file for each environment?

Currently, parameters in parameters.yml are used both in dev and prod , but I need different parameters for deploying my application in prod.

+6
source share
1 answer

You can put all the parameters used in your dev environment into the app\config\parameters_dev.yml file (you need to create it) and then import it into your app\config\config_dev.yml :

 imports: - { resource: config.yml } - { resource: parameters_dev.yml } 

Therefore, when you work in local mode, any parameter used in production will be overwritten with a new file with the correct parameters.

And don't forget to clear the cache!

+7
source

Source: https://habr.com/ru/post/984383/


All Articles