fix: do not emit error when RelayProxyEndpointsWithoutEvents is used #110
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.
When
RelayProxyEndpointsWithoutEvents
is used to configure an SDK'sServiceEndpoints
, it throws an error-level log message explaining that only some URIs are set.This logic was intended to surface a common mistake of only setting one URI when the developer meant to set all 3. In this case the error is incorrect as we're making this choice explicitly as a supported use-case: use Relay for streaming and polling, but send events to LaunchDarkly.
There are many ways to approach fixing this in a backwards compatible manner. Ideally, we'd have constructors that embody the supported use-cases.
To avoid introducing a new construction API, I've taken a minimal approach of adding a new setter/getter on the
ServiceEndpoint
struct to indicate if partial-specification of custom URIs was intentional or not.This way, we can later check that the constructed
ServiceEndpoints
intentionally hasn't set the events endpoint and decide whether or not to log a message.