Module rest

Module rest 

Source
Expand description

§REST Flag Resolver

Evaluates feature flags using the OpenFeature Remote Evaluation Protocol (OFREP) over HTTP.

§Features

  • HTTP-based flag evaluation
  • OFREP protocol support
  • Type-safe evaluation
  • Structured error handling
  • Comprehensive logging

§Supported Types

  • Boolean flags
  • String flags
  • Integer flags
  • Float flags
  • Structured flags

§Example

use open_feature_flagd::resolver::rest::RestResolver;
use open_feature_flagd::FlagdOptions;
use open_feature::provider::FeatureProvider;
use open_feature::EvaluationContext;

#[tokio::main]
async fn main() {
    let options = FlagdOptions {
        host: "localhost".to_string(),
        port: 8016,
        ..Default::default()
    };
    let resolver = RestResolver::new(&options);
    let context = EvaluationContext::default();
     
    let result = resolver.resolve_bool_value("my-flag", &context).await.unwrap();
    println!("Flag value: {}", result.value);
}

Structs§

RestResolver
REST-based resolver implementing the OpenFeature Remote Evaluation Protocol