open-feature / ruby-sdk

Ruby implementation of the OpenFeature SDK
https://openfeature.dev
Apache License 2.0
21 stars 7 forks source link

Setting a context for a client? #111

Closed grepfruit19 closed 4 months ago

grepfruit19 commented 4 months ago

I'm unsure on how to set a context for a client, e.g., a default context that all evaluations will use. Is there documentation on this/is this something that's possible?

I.e., something like this:

client.evaluation_context = EXAMPLE_CONTEXT

flag_details = client.fetch_boolean_details(flag_key: "ExampleBooleanFlag", default_value: false)

Additionally, passing a context to flag evaluations in general is not really well documented, probably something that would be handy to add to the README.

beeme1mr commented 4 months ago

Yeah, that's covered in the spec but likely unimplemented in Ruby.

maxveldink commented 4 months ago

We currently accept the client's eval context on build_client but we currently don't pass it in (we only use the invocation context, what's passed to the flag eval call directly). I'm working on a fix for that right now.