Skip to content

Commit

Permalink
docs: Add basic usage to README
Browse files Browse the repository at this point in the history
Signed-off-by: Max VelDink <[email protected]>
  • Loading branch information
maxveldink committed Apr 8, 2024
1 parent 417b35f commit 198fa90
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion providers/openfeature-sdk-meta_provider/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,30 @@ gem install openfeature-meta-provider

## Usage

Coming soon
The `MetaProvider` is initialized with a collection of `Provider`s and a strategy for fetching flags from them.

```ruby
# Create a MetaProvider
meta_provider = OpenFeature::SDK::Provider::MetaProvider.new(
providers: [
OpenFeature::SDK::ProviderInMemoryProvider.new,
MyCustomProvider.new
],
strategy: :first_match
)

# Use it as the default provider
OpenFeature.configure do |c|
c.set_provider(meta_provider)
end
```

### Strategies

#### :first_match

When `:first_match` is given as the strategy, each provider will be evaluated, in the order they were passed in, for the requested `flag_key`. The first provider where the `flag_key` is found will be returned, short-circuiting flag evaluation with the remaining providers. In the case of a provider error, or no matching flags, returns the default value.


## Contributing

Expand Down

0 comments on commit 198fa90

Please sign in to comment.