Edge Config
- stores arbitrary JSON data
- active global replication
- built specifically for feature flags
- high read volume, seldom updates
- edit using the dashboard or programmatically
Do not make these changes, this is just for educational purposes.
import { flag } from "flags/next";
import { get } from "@vercel/edge-config";
export const enableSummerSale = flag<boolean>({
key: "summer-sale",
async decide () {
const flags = await get("flags");
return flags.sale;
}
});
Edge Config adapter
import { flag } from 'flags/next';
import { edgeConfigAdapter } from '@flags-sdk/edge-config';
export const exampleFlag = flag({
// Will load the `flags` key from Edge Config
adapter: edgeConfigAdapter(),
// Will get the `example-flag` key from the `flags` object
key: 'example-flag',
});
Flag Provider
The Flags SDK integrates with many different flag providers, some of which an also sync their data into Edge Config and bootstrap the configuration from there.
import { flag } from "flags/next";
import { statsigAdapter } from '@flags-sdk/statsig';
export const enableSummerSale = flag<boolean>({
key: "summer-sale",
adapter: statsigAdapter.featureGate((gate) => gate.value)
});