Unable to use "local" application config files for database.json with user specified config environments #22

Closed
opened 2018-07-24 00:58:13 +00:00 by jamie · 6 comments
jamie commented 2018-07-24 00:58:13 +00:00 (Migrated from git.hazaar.io)

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.

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.
jamie commented 2018-09-01 08:47:32 +00:00 (Migrated from git.hazaar.io)

added ~160 label

added ~160 label
jamie commented 2019-01-30 04:41:12 +00:00 (Migrated from git.hazaar.io)

created merge request !7 to address this issue

created merge request !7 to address this issue
jamie commented 2019-01-30 04:41:13 +00:00 (Migrated from git.hazaar.io)

mentioned in merge request !7

mentioned in merge request !7
jamie commented 2019-01-30 04:43:26 +00:00 (Migrated from git.hazaar.io)

closed via merge request !7

closed via merge request !7
jamie commented 2019-01-30 04:43:26 +00:00 (Migrated from git.hazaar.io)

closed via commit efc816ddde

closed via commit efc816dddebe35f4c008b52e29b65e8de4c9cbca
jamie commented 2019-02-01 05:36:08 +00:00 (Migrated from git.hazaar.io)

mentioned in commit efc816ddde

mentioned in commit efc816dddebe35f4c008b52e29b65e8de4c9cbca
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: hazaar/hazaar-dbi#22
No description provided.