fix(runtime): HTTPClient configs now propagate to loaders + loader funcs - #48
Merged
philipaconrad merged 1 commit intoAug 4, 2026
Conversation
An `HTTPClient.Configuration` passed to `OPA.Runtime.init` never reached the bundle loaders. The Runtime stored it, but constructed every loader with `httpClientConfig: nil`, so each loader fell back to the global default config. We now propagate any provided config down to all bundle loaders, including the discovery bundler loader. We also now support HTTP config provider *closure* functions, which can be used to dynamically provide a correct HTTPClient configuration or TLSConfig on each `load()` call. This is anticipated to make certificate rotation easier to implement for advanced users. The `HTTPClientConfigSource` enum is used to select between different ways that the config should be acquired, and only the nil/fixed config cases can TLS settings be overridden by the OPA config: - `nil (none)`: Config file owns TLS. `credentials.client_tls` builds it on top of the global default http client config. - `.fixed(cfg)`: Config file owns TLS if `credentials.client_tls` is set. Without `client_tls`, the fixed config is used verbatim. - `.tls(provider)`: Provider owns TLS. - `.configuration(provider)`: Provider owns everything. Nothing from the OPA config is used. Note: For services using default/bearer/oauth2 credentials the loader never consults `services[_].tls`, so an injected configuration is currently the only way to configure TLS for them. Signed-off-by: Philip Conrad <philip_conrad@apple.com>
philipaconrad
force-pushed
the
philip/http-client-config
branch
from
August 4, 2026 22:57
f42a111 to
a756e66
Compare
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.
What changed, and why?
An
HTTPClient.Configurationpassed toOPA.Runtime.initnever reached the bundle loaders. The Runtime stored it, but constructed every loader withhttpClientConfig: nil, so each loader fell back to the global default config.We now propagate any provided config down to all bundle loaders, including the discovery bundler loader.
We also now support HTTP config provider closure functions, which can be used to dynamically provide a correct HTTPClient configuration or TLSConfig on each
load()call. This is anticipated to make certificate rotation easier to implement for advanced users.The
HTTPClientConfigSourceenum is used to select between different ways that the config should be acquired, and only the nil/fixed config cases can TLS settings be overridden by the OPA config:nil (none): Config file owns TLS.credentials.client_tlsbuilds it on top of the global default http client config..fixed(cfg): Config file owns TLS ifcredentials.client_tlsis set. Withoutclient_tls, the fixed config is used verbatim..tls(provider): Provider owns TLS..configuration(provider): Provider owns everything. Nothing from the OPA config is used.Note: For services using default/bearer/oauth2 credentials the loader never consults
services[_].tls, so an injected configuration is currently the only way to configure TLS for them.How to test
Related Resources