Expand description
The DOIGET_*_BASE test / proxy overrides, as one table (#587).
Every fetch source honours a DOIGET_<SOURCE>_BASE that points it at
another origin: a wiremock server in tests, an institutional proxy in the
field. The HTTP client has to agree with the sources about that, and it
used to do so through two hand-maintained copies (the CLI’s
build_http_client and the MCP server’s build_http_client_for_fetch),
each with a selection condition and a registration list. The lists knew
six to eleven of the fifteen overridable keys, so setting any one base put
the process in test mode and silently dropped the rest from the client –
datacite, hal, openaire, core and europe-pmc could not be mocked
at all.
BASE_OVERRIDES is now the only list, and test_client_from_env the
only builder that reads it.
§Which variables switch to the test client
Only the rows marked BaseOverride::selects_test_client – the same
seven the condition always tested. The others are honoured within test
mode but never cause it, and that asymmetry is deliberate: the production
client is https_only and applies its allowlists to redirects, so
DOIGET_APS_BASE=https://proxy.example.edu alone works today on the
production client, with every other source intact. Making it select the
test client would rebuild the process from the overrides alone and drop
Crossref, which is the regression the issue’s option 2 would have
shipped.
Test mode stays exclusive: a source with no override is absent from
the test client, so a test that forgot to mock one fails immediately and
offline with UnknownSource instead of reaching the real API. That
isolation is the property the issue’s first-proposed additive fix would
have lost.
Structs§
- Base
Override - One overridable source.
Enums§
- Base
Override Error - Why the override environment could not become a client.
Constants§
- BASE_
OVERRIDES - Every
DOIGET_*_BASEa fetch source reads. Rows sharing asourceare alternatives, the first one set winning:DOIGET_ARXIV_SRC_BASEis the source-bundle endpoint’s override and stands in forDOIGET_ARXIV_BASEonly when that is unset.
Functions§
- test_
client_ from test_client_from_envover an arbitrary variable lookup, for tests.- test_
client_ from_ env - The allow-http test client for the overrides set in the environment, or
Nonewhen noBaseOverride::selects_test_clientvariable is set and the caller should build its production client.