Expand description
User-extensible capability gate (ADR-0028, #220).
Parses the [[network.additional_hosts]] array-of-tables from the
user’s config.toml, validates each entry against the restricted
ADR-0028 D2-1 pattern grammar, and merges the user-added hosts into
the orchestrator’s oa-publisher crate::http::SourceAllowlist.
This module is intentionally minimal — it does NOT layer
config.toml with env vars or implement the full
docs/CONFIG.md resolution ladder. The full reader is a separate
slice (S3b); this slice ships only the surface needed for
ADR-0028 D2 (user-extensible allowlist) to actually work end-to-end.
§Wire contract (ADR-0028 D2-1)
[[network.additional_hosts]]
host = "ruj.uj.edu.pl"
note = "Jagiellonian University Repository — Green OA"
[[network.additional_hosts]]
host = "*.uj.edu.pl" # single-suffix wildcard, allowedEvery rejection class enforced by validate_pattern:
- empty string
- leading or trailing whitespace
- bare wildcard (
*) - multi-segment glob (
*.edu.*,*.*,*.foo.*) - mid-string wildcard (
foo.*.org,f*o.bar,*foo.bar) - no
.(single-label hostnames) - non-host characters (
@,/,:, port suffixes, scheme prefix) - empty leading / inner / trailing label
- label starting or ending with
-
Each rejection maps to a PatternError variant for downstream
consumers (S3b doiget config doctor) to branch on programmatically.
§Provenance & doctor (deferred to S3b)
ADR-0028 D2-2 / D2-3 / D2-4 (the verified_by = "user" provenance
field, doiget config doctor surface, doiget capabilities
user_extension_count) ship in the S3b follow-up. The
MCP-server-side merge in doiget-mcp is also deferred — this
slice wires user extensions only through the CLI production path
(commands::fetch::build_http_client). A user who configures
[[network.additional_hosts]] and invokes via doiget serve
(MCP) currently sees no effect; that is the load-bearing item
S3b closes.
Structs§
- Host
Pattern - A validated host pattern from
[[network.additional_hosts]]. - Invalid
Pattern Issue - One per-entry rejection inside
UserExtensionError::InvalidPatterns. - User
Extension Host - One user-added host entry from
[[network.additional_hosts]].
Enums§
- Pattern
Error - Closed-enum classification of a single pattern’s rejection
reason. Used by
validate_patternand carried as thekindfield onInvalidPatternIssue. S3b’sdoiget config doctorsurface branches on this for actionable per-error rendering. - User
Extension Error - Errors from loading
config.toml’s user-extension section.
Functions§
- load
- Load user-extension hosts from a
config.tomlpath. - merge_
into_ allowlists - Merge a slice of
UserExtensionHostinto theoa-publisherentry of an existing allowlist vector. - validate_
pattern - Validate a host pattern per ADR-0028 D2-1.