Skip to content

Commit 1ace945

Browse files
authored
fix: OFREP fix cargo publish, use cargo readme to align with cargodoc (#62)
Signed-off-by: Eren Atas <[email protected]>
1 parent f06f7ea commit 1ace945

File tree

3 files changed

+65
-5
lines changed

3 files changed

+65
-5
lines changed

crates/ofrep/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
[package]
22
name = "open-feature-ofrep"
3+
description = "The official OpenFeature Remote Evaluation Protocol (OFREP) provider for OpenFeature."
4+
documentation = "https://docs.rs/open-feature-ofrep"
5+
homepage = "https://openfeature.dev/"
6+
license = "Apache-2.0"
7+
repository = "https://github.com/open-feature/rust-sdk-contrib"
38
version = "0.0.2"
49
edition = "2024"
510

crates/ofrep/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ feature flag evaluation in your applications.
66

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

9-
### Installation
9+
#### Installation
1010
Add the dependency in your `Cargo.toml`:
1111
```bash
1212
cargo add open-feature-ofrep
@@ -29,7 +29,7 @@ async fn main() {
2929
let provider = OfrepProvider::new(OfrepOptions {
3030
base_url: "http://localhost:8016".to_string(),
3131
headers: headers.clone(),
32-
connect_timeout: Duration::from_secs(4),
32+
connect_timeout: Duration::from_secs(4),
3333
..Default::default()
3434
}).await.unwrap();
3535

@@ -42,7 +42,7 @@ async fn main() {
4242
}
4343
```
4444

45-
### Configuration Options
45+
#### Configuration Options
4646
Configurations can be provided as constructor options. The following options are supported:
4747

4848
| Option | Type / Supported Value | Default |
@@ -51,6 +51,5 @@ Configurations can be provided as constructor options. The following options are
5151
| headers | HeaderMap | Empty Map |
5252
| connect_timeout | Duration | 10 seconds |
5353

54-
### License
54+
#### License
5555
Apache 2.0 - See [LICENSE](./../../LICENSE) for more information.
56-

crates/ofrep/src/lib.rs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1+
//! [Generated by cargo-readme: `cargo readme --no-title --no-license > README.md`]::
2+
//! # OFREP Provider for OpenFeature
3+
//!
4+
//! A Rust implementation of the OpenFeature OFREP provider, enabling dynamic
5+
//! feature flag evaluation in your applications.
6+
//!
7+
//! This provider allows to connect to any feature flag management system that supports OFREP.
8+
//!
9+
//! ### Installation
10+
//! Add the dependency in your `Cargo.toml`:
11+
//! ```bash
12+
//! cargo add open-feature-ofrep
13+
//! cargo add open-feature
14+
//! ```
15+
//! Then integrate it into your application:
16+
//!
17+
//! ```rust,no_run
18+
//! use std::time::Duration;
19+
//! use open_feature::provider::FeatureProvider;
20+
//! use open_feature::EvaluationContext;
21+
//! use open_feature_ofrep::{OfrepProvider, OfrepOptions};
22+
//! use reqwest::header::{HeaderMap, HeaderValue};
23+
//!
24+
//! #[tokio::main]
25+
//! async fn main() {
26+
//! let mut headers = HeaderMap::new();
27+
//! headers.insert("color", HeaderValue::from_static("yellow"));
28+
//!
29+
//! let provider = OfrepProvider::new(OfrepOptions {
30+
//! base_url: "http://localhost:8016".to_string(),
31+
//! headers: headers.clone(),
32+
//! connect_timeout: Duration::from_secs(4),
33+
//! ..Default::default()
34+
//! }).await.unwrap();
35+
//!
36+
//! let context = EvaluationContext::default()
37+
//! .with_targeting_key("user-123")
38+
//! .with_custom_field("color", "yellow");
39+
//!
40+
//! let result = provider.resolve_bool_value("isColorYellow", &context).await.unwrap();
41+
//! println!("Flag value: {}", result.value);
42+
//! }
43+
//! ```
44+
//!
45+
//! ### Configuration Options
46+
//! Configurations can be provided as constructor options. The following options are supported:
47+
//!
48+
//! | Option | Type / Supported Value | Default |
49+
//! |-----------------------------------------|-----------------------------------|-------------------------------------|
50+
//! | base_url | string | http://localhost:8016 |
51+
//! | headers | HeaderMap | Empty Map |
52+
//! | connect_timeout | Duration | 10 seconds |
53+
//!
54+
//! ### License
55+
//! Apache 2.0 - See [LICENSE](./../../LICENSE) for more information.
56+
157
mod error;
258
mod resolver;
359

0 commit comments

Comments
 (0)