[discourse] Client side evaluation with initial read from file system #4312
Replies: 7 comments
-
The Flipt client-side SDKs (including JS/React) don't natively support loading state directly from the file system, but you can achieve this by providing a custom fetcher function when initializing the client. This fetcher can implement any logic you need, including reading a snapshot from the filesystem and returning it in the expected format. This approach lets you "fake" the Flipt URL and serve state from a local file if the real service is unavailable. See the FliptClient custom fetcher documentation for details. There's also an No direct file-backed fetchers are provided out of the box, but the SDK is designed to be extensible for this use case. You'd need to implement the custom fetcher logic yourself. No similar solutions or discussions were found for the Java SDK, but the pattern should be similar if it supports custom fetchers. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
Reply from erka on Discourse: Hey @mswiderski This option is not currently available. However, I believe it could be possible to have an additional option that allows the client to receive a string or byte array representing the initial fallback state. That said, accessing the file system may not be feasible across all environments (e.g., browsers, cloud functions), which could pose compatibility issues. Let’s see what @mark thinks about it. |
Beta Was this translation helpful? Give feedback.
-
Reply from mswiderski on Discourse: yeah, file system is certainly not a strict requirement as long as it can be string or bytes that would work out nicely. |
Beta Was this translation helpful? Give feedback.
-
Reply from mark on Discourse: Hey @mswiderski We just got a similar request today in our client sdk repo: Dart/Flutter support for iOS/Android · Issue #945 · flipt-io/flipt-client-sdks · GitHub I think this makes a lot of sense, we can expose the ability to seed the clients on startup as well as expose a method to get the latest state so you can save it in your app intermittently. Would this work? |
Beta Was this translation helpful? Give feedback.
-
Reply from mswiderski on Discourse: That would be excellent and fulfill all the needs we see at the moment. Thanks a lot for considering it. |
Beta Was this translation helpful? Give feedback.
-
Reply from mark on Discourse: Cheers. I will create an issue in our client side SDKs repo and get working on it ASAP Thank you again! |
Beta Was this translation helpful? Give feedback.
-
Reply from mark on Discourse: For tracking: Support Seeding Client SDKs with Serialized Flag State · Issue #970 · flipt-io/flipt-client-sdks · GitHub |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Originally posted by mswiderski on Discourse
Hello,
I am looking for an option to allow to fallback to initially load the state from file system when using client side sdk (java and react in my case). The use case for it is that the system can be installed in environments where flipt is available and in some that it won’t have access to flipt. The idea is to have an option to fallback to load the state from file - last known from git at build time.
Was looking into the docs and couldn’t find a way to do so, it seems it is always reaching out to a url. If there is no way to load it from file system what would it take to fake the flipt url to just return the state?
thanks
Maciej
Beta Was this translation helpful? Give feedback.
All reactions