Problem/Motivation
Provide a mechanism in core for handling configuration changes between different environments, such as Dev, Stage, Prod. For example, environments might have different modules enabled (e.g. Devel in Dev only, Acquia Connector in Prod only) and might have different configuration such as site name, SOLR server, API keys, etc.
Proposed resolution
- Add new "Config Transform" events triggered by config import and export that allow event subscribers to modify the configuration being imported or exported.
- Add new "Config Environment" core module that subscribes to the Config Transform events to provide environment-specific configuration.
Process and where to find it
This was proposed as a core feature in #2844681: Allow exported configuration to be environment-specific and adopted as part of the CMI 2.0 initiative #3008882: Roadmap for CMI 2.
Proposal roadmap
API changes
- Add new Config Transform import/export events that allow subscribers to modify config.
Provide Config Export Storage as a common interface for exporting config (to be used by Drush, etc) that can be modified to fire new transform event.#3036193: Add ExportStorage to allow config export in third party tools- Trigger Config Transform export event in ConfigExportStorage.
- Trigger Config Transform Import event in ConfigImport.
- Provide service to manage what current and desired "environments" are.
Data model changes
- Define the schema for an "environment".
- Store the id of the "current environment" (State)
- Store the id of the "desired environment" (Settings)
User interface changes
- Ability to specify which modules are installed or uninstalled in specific environments. (e.g., Devel module in dev environment, Google Analytics enabled in prod environment)
- Ability to specify which configuration items are overridden within specific environments. (e.g. system.site overridden in different environments for different site names)
- Provide a UI for creating and updating an environment.
- Provide a UI to switch environments, previewing the config changes to be applied.
- Warning on Config Sync page if the "current environment" doesn't match the "desired environment"
Remaining tasks
- Create experimental module for Config Transform events and test subscribers.
- Create experimental module for Config Environment that handles all environment-specific aspects. #3028179: Config Environment module (core experimental)
- Usability/Accessibilityt review of Config Environment UI.
- Security review of ConfigTransform and ConfigEnvironment.
Not in scope
- Only one environment can be enabled at any given time. Does not implement the ability in Config Split of having multiple "splits" enabled.
- Provides the config entity for an "environment" and service for managing environments, but does not solve all of the other myriad of environment use-cases provided by many different modules. Would allow those modules to potentially determine what environment is currently active on a site.
- Does not handle multiple translations of environment-specific configuration, which would require collections within collections.