MCPcopy Create free account
hub / github.com/vercel/examples / createSplitClient

Function createSplitClient

edge-middleware/feature-flag-split/lib/split.ts:11–33  ·  view source on GitHub ↗
(userKey: string)

Source from the content-addressed store, hash-verified

9const edgeConfigClient = createClient(process.env.EDGE_CONFIG)
10
11export async function createSplitClient(userKey: string) {
12 const client = SplitFactory({
13 core: {
14 authorizationKey: process.env.SPLIT_SDK_CLIENT_API_KEY!,
15 key: userKey,
16 },
17 mode: 'consumer_partial',
18 storage: PluggableStorage({
19 wrapper: EdgeConfigWrapper({
20 // The Edge Config item where Split stores feature flag definitions, specified in the Split integration step
21 edgeConfigItemKey: process.env.EDGE_CONFIG_SPLIT_ITEM_KEY!,
22 edgeConfig: edgeConfigClient,
23 }),
24 }),
25 // Disable or keep only ERROR log level in production, to minimize performance impact
26 debug: ErrorLogger(),
27 }).client()
28
29 // Wait to load feature flag definitions from the Edge Config
30 await client.ready()
31
32 return client
33}

Callers 2

MarketingFunction · 0.90
AboutFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected