* Affected components: MediaWiki core., extensions / skins that want to use the mechanism(s)
* Engineer(s) or team for initial implementation: TBD.
* Code steward: TBD.
### Motivation
I would like to be able to cleaneasily define configuration (core + extension modes (services as well as individual configuration variables) for automated tests in our CI environment. A secondary goal is to simplify the process of setting up an a development environment for frontend engineers,. QA testersThese modes could be used for simplifying developer setups in local development, product managers who may not have the time or resources to step through intricate documentation for certain setupsas well as for providing more flexibility for automated testing.
I'm creating this as an RFC so that various teams and contributors can collectively discuss what we want to see and what would work well.
##### Requirements
* **The ability to define ServiceWiring overrides for a particular environment **. For example when my extension is operating in the context of CI tests, I want to redefine some services that my extension provides to use static implementations instead of production implementations that rely on services which may not exist (ElasticSearch, Memcache, etc).
* The patch in "Exploration" provides the ability to define "ServiceWiringCI.php" and "ServiceWiringDevelopment.php" which extend and override the primary, production ServiceWiring.php file
* **The ability to override particular Config values for a given environment**. T173955 might have some overlap here, or maybe not. Ideally one would be able to execute tests in parallel with configuration specific to those tests.
* **The ability to define and override arbitrary environments.** "CI" might work well for some extensions, but other features are more complicated and have a variety of modes they operate under, so we should be able to define a common CI configuration and then sub configurations that could inherit from the common one.
* **An easy way to determine, in code, which "environment" mode(s) you are in**, i.e. Production, Development, CI, or whatever other custom variant you have defined. [Symfony framework](https://symfony.com/doc/current/configuration.html#different-environments-different-configuration-files) has some prior art we could look at here if we don't want to invent our own thing. I could also see how local developer setups and browser / api-testing tests may want to specify that the site is operating in multiple environment modes depending on what is defined by a given extension (e.g. "use GrowthExperiments remote configuration loader mode and Vector version 2 mode").
* Currently we have code which relies on [$wgWikimediaJenkinsCI](https://codesearch.wmcloud.org/search/?q=WikimediaJenkinsCI&i=nope&files=&repos=), whatever mechanism we set up here would replace that
* **Setting the environment mode should be possible via the HTTP request (or CLI command), perhaps using a cookie, a request header, or request parameter**, so that the Selenium or api-testing framework does not necessarily need to be running on the same filesystem as MediaWikirequest parameter, and to allow for parallel tests
* **The ability to override particular Config values for a given test**.or an environment variable**, T173955 might have some overlap hereso that the Selenium or api-testing framework does not necessarily need to be running on the same filesystem as MediaWiki, or maybe notand to allow for parallel tests. Ideally one would be able to execute tests in parallel with configuration specific to those testsAn environment variable would be handy for #MediaWiki-Docker for less technical users to be able to easily run MediaWiki in a given mode(s).
See also:
* {T230211}
* {T199939}
* {T240244} / {T243516}
* {T267304}
-------
### Exploration
* Patch: [Add flag for specifying environment MediaWiki is running in](https://gerrit.wikimedia.org/r/c/mediawiki/core/+/641156)
* ?