[6.x] Optimize general config loading#19245
Conversation
📚 Storybook previews@craftcms/cp — open Storybook No changed components detected in this Storybook. resources/js — open Storybook No changed components detected in this Storybook. |
There was a problem hiding this comment.
Pull request overview
This PR refactors how GeneralConfig is loaded and normalized so that array-based config and CRAFT_* environment overrides are applied via fluent setters (allowing normalization) before the resulting instance is stored back into Laravel’s config repository. It also relocates several legacy/compat behaviors (renamed settings, callable config, app-type overlays, and Laravel-backed deprecated settings) into yii2-adapter, and changes normalization failures to propagate rather than silently falling back.
Changes:
- Materialize
GeneralConfigthrough the container binding, applying static config + env overrides through fluent setters, then storing the instance back into the config repository. - Move legacy compatibility behaviors (renamed settings mapping, callable config, app-type overlays, deprecated Laravel-backed settings) into
yii2-adapter. - Update tests to reflect the new ownership boundaries and failure behavior.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| yii2-adapter/tests-laravel/Legacy/ConfigCompatibilityTest.php | Adds adapter-focused tests for callable config preservation, renamed settings mapping, and overlay conversion. |
| yii2-adapter/src/Yii2ServiceProvider.php | Applies adapter conversion for callable/app-type general config overlays before legacy bootstrapping. |
| yii2-adapter/src/Config/MultiEnvironmentConfigCompatibility.php | Stops overwriting non-array config values, enabling callable general config to survive compatibility merging. |
| yii2-adapter/src/Config/GeneralConfigCompatibility.php | Introduces conversion logic for callable general config and web/console overlays (adapter-only). |
| yii2-adapter/legacy/services/Users.php | Switches verification-code expiry to rely on auth.passwords.craft.expire. |
| yii2-adapter/legacy/services/Config.php | Removes exception-swallowing fallback when fluent normalization fails for env config. |
| yii2-adapter/legacy/Craft.php | Updates cookie domain source to use Laravel’s session.domain. |
| yii2-adapter/legacy/config/GeneralConfig.php | Reintroduces legacy-only settings and bridges them to Laravel config with deprecation logging. |
| tests/Unit/Config/GeneralConfigTest.php | Removes renamed-settings and moved/deprecated-member assertions from the new core GeneralConfig. |
| tests/Unit/Config/ConfigServiceProviderTest.php | Adds coverage for container materialization, env override precedence, and failure propagation behavior. |
| src/Cp/Cp.php | Reads “remember me” duration from auth.guards.craft.remember rather than removed config properties. |
| src/Config/GeneralConfig.php | Removes renamed settings + moved deprecated settings from the core class. |
| src/Config/ConfigServiceProvider.php | Refactors general config loading into a container singleton that normalizes via fluent setters and persists the instance back into config. |
Description
Better loading of the GeneralConfig, requiring less machinery to make
CRAFT_overrides work.Also moves more deprecated settings and the renamed properties to the legacy GeneralConfig class