Repository navigation
A middleware reads its own settings from [middleware.<name>] - #1379
Draft
jwrosewell wants to merge 3 commits into
Draft
jwrosewell wants to merge 3 commits into
jwrosewell wants to merge 3 commits into
Conversation
A middleware had no table of its own. A module's one middleware read the module's table, and a vendor whose module supplies several middleware put their settings under the vendor's shared table, where a page change's options sat beside the vendor's endpoint and license key, which is where nothing about one middleware belongs. Settings gain [middleware], one [middleware.<name>] table for each middleware that has settings, written with the middleware's full name, so [middleware.example.cleanup] is the example.cleanup middleware's. A table holds values and arrays, and a table within one is the table of the longer name it spells and never a setting, so a middleware never sees another's settings. Core reads none of a table. A middleware reads its own through Settings::middleware_config, which refuses a key the middleware does not know and a value that fails its validation. The section refuses a value where only tables stand and a name no middleware could have, and the registry refuses at startup a table at a name that no module it runs supplies, with the names that could be written, as it refuses an entry naming such a middleware. A middleware with no table of its own reads its module's table, as the stock modules do. The fixture module gains a middleware with a table of its own, and tests cover a middleware reading its table and not a longer name's, a table at a name nothing supplies refused on both shapes, a key the middleware does not know refused with the table and the key named, and the section's own refusals. The guide documents the section beside the shared tables and says where a middleware's settings live, and the changelog says what it adds.
# Conflicts: # crates/trusted-server-core/src/integrations/registry.rs
Two doc comments used a vendor's middleware as their example of a deeper table. The examples now use the fixture's example names, as the guide does.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
crates/trusted-server-core/srcdocs/guideCHANGELOG.mdCloses
Closes #1331
Test plan
CI: 19 of 19 checks green, the fork's CI on f18d248 (jwrosewell#33).
cargo test-fastly && cargo test-axumcargo clippy-fastly && cargo clippy-axumcargo fmt --all -- --checkcd crates/trusted-server-js/lib && npx vitest runcd crates/trusted-server-js/lib && npm run formatcd docs && npm run formatcargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1fastly compute serveChecklist
unwrap()in production code (clippy deniesunwrap_usedin CI)logmacros as AGENTS.md asks (notprintln!)On top of the origin's redirect to itself kept on the reader's address (#32). Issue: #1331.
What this adds
What changes.
A middleware with settings of its own reads them from
[middleware.<name>], one table for each middleware, written with the middleware's full name.How it works.
[middleware.example.cleanup]is theexample.cleanupmiddleware's table. A table holds values and arrays. A table within one is the table of the longer name it spells and never a setting, so[middleware.example.cleanup]beneath[middleware.example]belongs toexample.cleanupand theexamplemiddleware never sees it.Settings::middleware_config, which refuses a key the middleware does not know and a value that fails its validation, naming the table.[middleware]where only tables stand, a table at a name no middleware could have, and a table at a name that no module the deployment runs supplies, with the names that could be written, as an entry naming such a middleware is refused today.Why
A module's one middleware could read the module's table, and nothing else had a place. A vendor whose module supplies several middleware had to put their settings under the vendor's shared table, where the options of one page change sat beside the vendor's endpoint and license key, which is where nothing about one middleware belongs. A table of each middleware's own keeps a vendor's shared table to what every module of the vendor shares, and keeps every table refusing what it does not know.
What breaks
Nothing. A document without
[middleware]reads as before, and no stock module reads the section.The commits
CI being read on HEAD_ID.
What is not in this pull request