[Generated by cargo-readme: `cargo readme --no-title --no-license > README.md`]::
# 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`:
```bash
cargo add open-feature-ofrep
cargo add open-feature
```
Then integrate it into your application:
```rust
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:
| base_url | string | http://localhost:8016 |
| headers | HeaderMap | Empty Map |
| connect_timeout | Duration | 10 seconds |
#### License
Apache 2.0 - See [LICENSE](./../../LICENSE) for more information.