#open-feature #provider #evaluation #connect #ofrep

open-feature-ofrep

The official OpenFeature Remote Evaluation Protocol (OFREP) provider for OpenFeature

2 releases

Uses new Rust 2024

0.0.4 Aug 11, 2025
0.0.3 Jul 28, 2025

#4 in #open-feature

Download history 69/week @ 2025-08-12 5/week @ 2025-08-19 1/week @ 2025-08-26 4/week @ 2025-09-30

68 downloads per month

Apache-2.0

40KB
811 lines

OFREP Provider for OpenFeature

A Rust implementation of the OpenFeature OFREP provider, enabling dynamic feature flag evaluation in your applications.

This provider allows to connect to any feature flag management system that supports OFREP.

Installation

Add the dependency in your Cargo.toml:

cargo add open-feature-ofrep
cargo add open-feature

Then integrate it into your application:

use std::time::Duration;
use open_feature::provider::FeatureProvider;
use open_feature::EvaluationContext;
use open_feature_ofrep::{OfrepProvider, OfrepOptions};
use reqwest::header::{HeaderMap, HeaderValue};

#[tokio::main]
async fn main() {
    let mut headers = HeaderMap::new();
    headers.insert("color", HeaderValue::from_static("yellow"));

    let provider = OfrepProvider::new(OfrepOptions {
        base_url: "http://localhost:8016".to_string(),
        headers: headers.clone(),
        connect_timeout: Duration::from_secs(4),
        ..Default::default()
    }).await.unwrap();

    let context = EvaluationContext::default()
                    .with_targeting_key("user-123")
                    .with_custom_field("color", "yellow");

    let result = provider.resolve_bool_value("isColorYellow", &context).await.unwrap();
    println!("Flag value: {}", result.value);
}

Configuration Options

Configurations can be provided as constructor options. The following options are supported:

Option Type / Supported Value Default
base_url string http://localhost:8016
headers HeaderMap Empty Map
connect_timeout Duration 10 seconds

License

Apache 2.0 - See LICENSE for more information.

Dependencies

~9–24MB
~283K SLoC