Skip to content

Conversation

@erka
Copy link
Member

@erka erka commented Oct 31, 2025

This PR

Add experimental WithFromEnv() option to configure the OFREP provider using
environment variables.

  • Add WithFromEnv() configuration option supporting:
    • OFREP_ENDPOINT: base URI for the OFREP service
    • OFREP_TIMEOUT: timeout duration (e.g., "30s", "500ms")
    • OFREP_HEADERS: comma-separated custom headers

Related Issues

@erka erka force-pushed the rd/ofrep branch 3 times, most recently from 090b8f0 to 2bb7de9 Compare November 6, 2025 11:57
@erka erka changed the title feat(ofrep): add environment variable configuration and improve provider feat(ofrep): add environment variable configuration Nov 6, 2025
Add experimental WithFromEnv() option to configure the OFREP provider using
environment variables.

New features:
- Add WithFromEnv() configuration option supporting:
  - OFREP_ENDPOINT: base URI for the OFREP service
  - OFREP_TIMEOUT: timeout duration (e.g., "30s", "500ms")
  - OFREP_API_KEY: API key for X-API-Key authentication
  - OFREP_BEARER_TOKEN: token for Bearer authentication
  - OFREP_HEADERS: comma-separated custom headers

Signed-off-by: Roman Dmytrenko <[email protected]>
@erka erka marked this pull request as ready for review November 30, 2025 22:16
@erka erka requested review from a team as code owners November 30, 2025 22:16
// - OFREP_ENDPOINT: base URI for the OFREP service
// - OFREP_TIMEOUT: timeout duration (e.g., "30s", "1m" or raw "5000" in milliseconds )
// - OFREP_HEADERS: comma-separated custom headers (e.g., "Key1=Value1,Key2=Value2")
func WithFromEnv() func(*outbound.Configuration) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the cloud native approach of using EnvVar, but I think we should apply this by default. So when a user decides to set this, it will utilize those. The benefit is, that you can set this without a deployment and the usage of this variable.

The usual cloudnative approach is EnvVar -> setting -> default. https://github.com/open-feature/flagd-testbed/blob/main/gherkin/config.feature out lines this via gherkin files.

This is just a suggestion, not sure if this approach has been discussed or not :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aepfli Could you please clarify what you mean? Should I append WithFromEnv() to the options when creating the OFREP provider?

Right now this is just a building block, so people can opt in if they want to use it like this

	ofrep.NewProvider("https://default.endpoint", ofrep.WithFromEnv())

This is similar to the OTEL approach. https://pkg.go.dev/go.opentelemetry.io/otel/sdk/resource#WithFromEnv

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erka - based on the information provided I am now torn ;) - the cloud native way or at least how i interpret it (@toddbaert correct me if i am wrong) would be to append it, or do it automagically, to fallback to the env variables if there is not dedicated configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants