Skip to content

[6.x] Optimize general config loading#19245

Open
riasvdv wants to merge 3 commits into
6.xfrom
feature/general-config-loading
Open

[6.x] Optimize general config loading#19245
riasvdv wants to merge 3 commits into
6.xfrom
feature/general-config-loading

Conversation

@riasvdv

@riasvdv riasvdv commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

📚 Storybook previews

@craftcms/cpopen Storybook

No changed components detected in this Storybook.

resources/jsopen Storybook

No changed components detected in this Storybook.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 GeneralConfig through 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.

Comment thread yii2-adapter/legacy/services/Users.php Outdated
Comment thread yii2-adapter/legacy/config/GeneralConfig.php Outdated
@riasvdv riasvdv marked this pull request as ready for review July 13, 2026 19:45
@riasvdv riasvdv requested a review from brandonkelly July 13, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants