Problem/Motivation

While testing Orange Logic (quarterly upgrades, for example), it is useful to be able to compare the returned data from various server endpoints and sessions. Having to change configuration every time the test source needs to change is onerous, and, in some instances (such as non-writable filesystems) impossible.

I tried to use an instance of ConfigFactoryOverrideInterface to allow for temporarily overriding the configuration from the command line, but two things blocked this from working: 1) OrangeDamApi doesn't just instantiate a configFactory in its constructor, but also loads an immutable config at instantiation time, rather than at the time it is being used, meaning that any provided dynamic overrides are "too late". 2) Even if OrangeDamApi loaded its config only at the time it is needed, it would still be impossible to override anything that might have been set in a settings.php file.

Steps to reproduce

1. Create an instance of a ConfigFactoryOverrideInterface.
2. Use this instance to override the installed configuration, for, say, the orange_dam.settings base_path.
3. See that OrangeDamApi uses the config loaded at construction, rather than the config provided via your override interface.

Proposed resolution

One solution would be to modify the OrangeDamApi constructor to only instantiate the configFactory, and not load the actual config. But this still leaves us unable to override any configuration that might have been set in settings files.

The more flexible (but also more ad hoc) solution is to provide a public configOverride() method to OrangeDamApi allowing the configuration to be injected before instantiating the Orange Dam client.

Remaining tasks

Create a merge request showing the changes in suggestion 2.

User interface changes

none

API changes

The addition of a new method allowing for run-time re-configuration of the orange dam client.

Data model changes

none

Issue fork orange_dam-3440353

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

apotek created an issue. See original summary.

apotek’s picture

Status: Active » Needs review
markdorison’s picture

Status: Needs review » Reviewed & tested by the community

  • apotek committed 89634c28 on 1.x
    Issue #3440353 by apotek, markdorison: Allow dynamic configuration/...
apotek’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.