To streamline the middleware setup, we are centralizing all middleware management and shifting the configuration responsibilities directly to the middleware itself. This approach simplifies the process and improves maintainability.
Key Improvements
Eliminate the need for custom YAML middleware configuration by utilizing Loco's default middleware settings.
Introduce a middleware application hook to enable the creation of custom middleware.
Retrieve a list of all enabled middleware by running cargo loco middleware.
Improvements:
Remove all the middleware yaml configuration and work with Loco default middleware
Create a middleware app Hook to create custom middleware
Get the list of all enabled middleware by running the command cargo loco middleware.
Default Middleware Settings:
catch_panic: Enabled by default
compression: Enabled by default
cors: Disabled by default
etag: Enabled by default
fallback: Disabled by default
limit_payload: Enabled by default with a 2MB limit
logger: Enabled by default
remote_ip: Disabled by default
request_id: Enabled by default
secure_headers: Enabled by default
static_assets: Disabled by default
timeout: Disabled by default
I have implemented integration tests for most of the middleware components.
TBD:
[x] Remove middleware configuration from starters
[x] Documentation
[x] Show also middleware settings with --details flag
To streamline the middleware setup, we are centralizing all middleware management and shifting the configuration responsibilities directly to the middleware itself. This approach simplifies the process and improves maintainability.
Key Improvements
cargo loco middleware
.Improvements:
cargo loco middleware
.Default Middleware Settings:
catch_panic:
Enabled by defaultcompression:
Enabled by defaultcors:
Disabled by defaultetag:
Enabled by defaultfallback:
Disabled by defaultlimit_payload:
Enabled by default with a 2MB limitlogger:
Enabled by defaultremote_ip:
Disabled by defaultrequest_id:
Enabled by defaultsecure_headers:
Enabled by defaultstatic_assets:
Disabled by defaulttimeout:
Disabled by defaultI have implemented integration tests for most of the middleware components.
TBD:
--details
flag