Unable to use "local" application config files for database.json with user specified config environments
The DBI::Adapter
class has a feature where it is possible to specify the config environment when instantiating the object. This allows us to have multiple configurations stored in the database.json
file that can be used anywhere in the application.
This may turn out to not be the right way to do this. Previously, this was working fine until I introduced the concept of local configuration overrides. The overrides allow configurations to be specified for the local machine and not stored in the actual application. A prime example of their use is for storing IP addresses for services as the same application may be distributed but want to connect to different things, for say, caching.
The problem I have is with an application database.json
file that has multiple config environments specified, one of which is a user-specified. This user environment is then referred to specifically when instantiating the Adapter object to load a concurrent database connection to the default one. In this case, this will be localhost. However, in the local development environment this needs to be another server.
Normally it would be possible to just specify a local override config, however these local overrides are loaded regardless of the application environment, so therefore the config environments are not specified in the override files themselves. Which means there is no way to reference a specific database config in a local override file.