Symfony holds configuration parameters in /app/config/parameters.ini.
I’d like to to use different sets of parameters based on the hostname. Initially the hostname will determine the database to use but may well expand to cover more.
I’d prefer that the parameters per host are stored in a separate file so as to make this easy to programmatically generate.
Conceptually I’d like to store configuration parameters like this:
/app/config/parameters.ini
/app/config/foo.example.com.parameters.ini
/app/config/bar.example.com.parameters.ini
I see that /app/config/parameters.ini is referenced in \Sensio\Bundle\DistributionBundle\Controller\ConfigurationController and that modifying this file should work.
Is this be best approach? Is there a more straightforward approach that does not require patching the core framework?
I would think about different environments which use different parts for one ini file. You could have a prod1 environment using parameters prefixed with prod1 and a prod2 with the same:
parameters.ini:
They both use the prod.yml configuration but overwrite the stuff you want to read from the parameters.ini:
config_prod1.yml:
This way you also get around the caching issue, as you already have on cache per environment.
To seperate the two, either create and use a app_prod1.php and app_prod2.php as you would with the dev environment or change the environment depending on the host in you app.yml.