Skip to content

Improve config folder structure and add caching - #708

Merged
giuscris merged 4 commits into
2.xfrom
update-config-structure
Jun 15, 2025
Merged

Improve config folder structure and add caching#708
giuscris merged 4 commits into
2.xfrom
update-config-structure

Conversation

@giuscris

Copy link
Copy Markdown
Member

No description provided.

@giuscris giuscris added this to the 2.0.0 milestone Jun 14, 2025
@giuscris
giuscris requested a review from Copilot June 14, 2025 15:38
@giuscris giuscris self-assigned this Jun 14, 2025
@giuscris giuscris added the enhancement New feature or request label Jun 14, 2025
@giuscris giuscris changed the title Improve config handling Improve config structure and add caching Jun 14, 2025

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 centralizes and optimizes configuration loading by introducing caching, removing legacy default layers, and standardizing how defaults are accessed in controllers.

  • Adds a host-scoped cache layer in ConfigServiceLoader to speed up repeated bootstraps.
  • Removes the old “defaults” mechanism from Config, consolidating onto a single config array and throwing on load errors.
  • Refactors panel/site controllers to use a new defaultConfig() helper instead of removed defaults() methods and updates routing/methods paths.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
formwork/src/Services/Loaders/ConfigServiceLoader.php Implements file-based caching for resolved configs, per host
formwork/src/Panel/Controllers/OptionsController.php Replaces app->defaults()/site->defaults() with defaultConfig()
formwork/src/Config/Exceptions/ConfigLoadingException.php Introduces exception for missing/unsupported config files
formwork/src/Config/Config.php Drops separate defaults storage, adds load-file error handling
formwork/src/Cms/Site.php Removes legacy defaults merge, renames alias loader to setRouteAliases
formwork/src/Cms/App.php Adjusts DI definitions order and view-methods path resolution
formwork/config/system.yaml Updates routes and views.methods file paths
Comments suppressed due to low confidence (1)

formwork/src/Cms/Site.php:459

  • You renamed loadRouteAliases() to setRouteAliases(array $aliases), but removed its invocation in load(). To restore route aliases setup, call $this->setRouteAliases($this->data['routeAliases']) (e.g. right after populating $this->data).
$this->fields->setModel($this);

@giuscris giuscris changed the title Improve config structure and add caching Improve config folder structure and add caching Jun 14, 2025
@giuscris
giuscris force-pushed the update-config-structure branch from 87e77c2 to f82ea6f Compare June 14, 2025 19:44
@giuscris
giuscris merged commit 82bcfbd into 2.x Jun 15, 2025
@giuscris
giuscris deleted the update-config-structure branch June 15, 2025 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants