-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds Flagsmith adapter #103
base: main
Are you sure you want to change the base?
Conversation
@tiagoapolo is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
New and updated dependencies detected. Learn more about Socket for GitHub ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contributions so far! I left a bit of early guidance
@@ -0,0 +1,64 @@ | |||
# Flags SDK - Flagsmith Provider | |||
|
|||
A provider adapter for the Flags SDK that integrates with [Flagsmith](https://flagsmith.com/), allowing you to use Flagsmith's feature flags and remote configuration in your application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you work for Flagsmith? If we merge this PR we'd also put up some actual docs on flags-sdk.dev. Would you be wiling to link to our Flags SDK and those docs from https://docs.flagsmith.com?
// Define your flags | ||
const myFeatureFlag = flag({ | ||
key: 'my-feature', | ||
adapter: flagsmithAdapter, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pattern other adapters follow is this
const myFeatureFlag = flag({
key: 'my-feature',
adapter: flagsmithAdapter.getFeature(),
});
Configuring SDKs per feature flag
We are able to pass additional information for that specific flag, for example if the key of the flagsmith flag differed from the key of the Flags SDK flag you could do adapter: flagsmithAdapter.getFeature({ key: "foo" })
Lazy mode
We usually export a default adapter, which is initialized lazily, so people can use the default adapter without any configuration. For this to work, the Flagsmith adapter needs to respect a default set of environment variables, eg FLAGSMITH_ENVIRONMENT_ID
.
import { flagsmithAdapter } from "@flags-sdk/flagsmith"
const myFeatureFlag = flag({
key: 'my-feature',
adapter: flagsmithAdapter.getFeature(),
})
You can check the implementation of the Statsig/LaunchDarkly adapters as a reference.
This pull request introduces a new provider adapter for the Flags SDK that integrates with Flagsmith. The changes include adding configuration files, updating dependencies, and creating the necessary code for the adapter.
Flagsmith documentation: https://docs.flagsmith.com/clients/next-ssr
Usage