diff --git a/.github/workflows/vercel-preview.yaml b/.github/workflows/vercel-preview.yaml
index 408f41ec..df0a5bfa 100644
--- a/.github/workflows/vercel-preview.yaml
+++ b/.github/workflows/vercel-preview.yaml
@@ -3,8 +3,8 @@ env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
OPTIMIZELY_GRAPH_SINGLE_KEY: ${{ secrets.OPTIMIZELY_GRAPH_SINGLE_KEY }}
- OPTIMIZELY_CMS_HOST: ${{ secrets.OPTIMIZELY_CMS_HOST }}
- OPTIMIZELY_GRAPH_URL: ${{ secrets.OPTIMIZELY_GRAPH_URL }}
+ OPTIMIZELY_CMS_URL: ${{ secrets.OPTIMIZELY_CMS_URL }}
+ OPTIMIZELY_GRAPH_GATEWAY: ${{ secrets.OPTIMIZELY_GRAPH_GATEWAY }}
on:
push:
branches-ignore:
diff --git a/.github/workflows/vercel-prod.yaml b/.github/workflows/vercel-prod.yaml
index 88772123..c5bcf04e 100644
--- a/.github/workflows/vercel-prod.yaml
+++ b/.github/workflows/vercel-prod.yaml
@@ -3,8 +3,8 @@ env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
OPTIMIZELY_GRAPH_SINGLE_KEY: ${{ secrets.OPTIMIZELY_GRAPH_SINGLE_KEY }}
- OPTIMIZELY_CMS_HOST: ${{ secrets.OPTIMIZELY_CMS_HOST }}
- OPTIMIZELY_GRAPH_URL: ${{ secrets.OPTIMIZELY_GRAPH_URL }}
+ OPTIMIZELY_CMS_URL: ${{ secrets.OPTIMIZELY_CMS_URL }}
+ OPTIMIZELY_GRAPH_GATEWAY: ${{ secrets.OPTIMIZELY_GRAPH_GATEWAY }}
on:
push:
branches:
diff --git a/__test__/test-website/.env.in b/__test__/test-website/.env.in
new file mode 100644
index 00000000..e843f2ca
--- /dev/null
+++ b/__test__/test-website/.env.in
@@ -0,0 +1,21 @@
+# Base URL of your CMS instance
+# Example: https://example.cms.optimizely.com/
+OPTIMIZELY_CMS_URL=
+
+# Content Graph endpoint (optional)
+# Use to specify a non-production instance or different version
+# Default: https://cg.optimizely.com/content/v2
+OPTIMIZELY_GRAPH_GATEWAY=
+
+# Content Graph authentication key
+# Found in: CMS instance > Settings > API Keys
+OPTIMIZELY_GRAPH_SINGLE_KEY=
+
+# CLI client credentials for syncing manifest data
+# Create in: CMS instance > Settings > API Keys > Create API key
+OPTIMIZELY_CMS_CLIENT_ID=
+OPTIMIZELY_CMS_CLIENT_SECRET=
+
+# Feature Experimentation credentials
+OPTIMIZELY_FX_SDK_KEY=
+OPTIMIZELY_FX_ACCESS_TOKEN=
diff --git a/__test__/test-website/.gitignore b/__test__/test-website/.gitignore
index 1ec5eb93..45c45c9d 100644
--- a/__test__/test-website/.gitignore
+++ b/__test__/test-website/.gitignore
@@ -32,6 +32,7 @@ yarn-error.log*
# env files (can opt-in for committing if needed)
.env*
+!.env.in
# vercel
.vercel
diff --git a/__test__/test-website/src/app/all/[...slug]/page.tsx b/__test__/test-website/src/app/all/[...slug]/page.tsx
index b2328d90..7f1ac1d6 100644
--- a/__test__/test-website/src/app/all/[...slug]/page.tsx
+++ b/__test__/test-website/src/app/all/[...slug]/page.tsx
@@ -14,7 +14,7 @@ export default async function Page({ params }: Props) {
const { slug } = await params;
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
- graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
+ graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
});
const content = await client.getContentByPath(`/${slug.join('/')}/`);
diff --git a/__test__/test-website/src/app/en/[...slug]/page.tsx b/__test__/test-website/src/app/en/[...slug]/page.tsx
index 3ddc8dee..8ad4e356 100644
--- a/__test__/test-website/src/app/en/[...slug]/page.tsx
+++ b/__test__/test-website/src/app/en/[...slug]/page.tsx
@@ -32,7 +32,7 @@ export default async function Page({ params, searchParams }: Props) {
const path = `/en/${slug.join('/')}/`;
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
- graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
+ graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
});
const variation = (await searchParams).variation;
diff --git a/__test__/test-website/src/app/missing-content-types/page.tsx b/__test__/test-website/src/app/missing-content-types/page.tsx
index 9da2f21d..2f2395b8 100644
--- a/__test__/test-website/src/app/missing-content-types/page.tsx
+++ b/__test__/test-website/src/app/missing-content-types/page.tsx
@@ -17,9 +17,9 @@ export default async function Page({ searchParams }: Props) {
const { path } = await searchParams;
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
- graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
+ graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
});
- const c = await client.fetchContent(path);
+ const c = await client.getContentByPath(path);
return
{c};
}
diff --git a/__test__/test-website/src/app/multi-host/[...slug]/page.tsx b/__test__/test-website/src/app/multi-host/[...slug]/page.tsx
index e20afcda..d98ccc67 100644
--- a/__test__/test-website/src/app/multi-host/[...slug]/page.tsx
+++ b/__test__/test-website/src/app/multi-host/[...slug]/page.tsx
@@ -14,7 +14,7 @@ export default async function Page({ params }: Props) {
const { slug } = await params;
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
- graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
+ graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
});
const host =
process.env.NEXTJS_HOST ?? `https://localhost:${process.env.PORT ?? 3000}`;
diff --git a/__test__/test-website/src/app/preview/page.tsx b/__test__/test-website/src/app/preview/page.tsx
index d7ed3809..525e2c4d 100644
--- a/__test__/test-website/src/app/preview/page.tsx
+++ b/__test__/test-website/src/app/preview/page.tsx
@@ -9,7 +9,7 @@ type Props = {
export default async function Page({ searchParams }: Props) {
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
- graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
+ graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
});
const response = await client
@@ -30,7 +30,7 @@ export default async function Page({ searchParams }: Props) {
return (
<>
diff --git a/__test__/test-website/src/app/related/[...slug]/page.tsx b/__test__/test-website/src/app/related/[...slug]/page.tsx
index ef057737..1efc5e88 100644
--- a/__test__/test-website/src/app/related/[...slug]/page.tsx
+++ b/__test__/test-website/src/app/related/[...slug]/page.tsx
@@ -13,7 +13,7 @@ export default async function Page({ params }: Props) {
const { slug } = await params;
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
- graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
+ graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
});
const children = (await client.getItems(`/${slug.join('/')}`)) ?? [];
diff --git a/docs/5-fetching.md b/docs/5-fetching.md
index e33ed6da..6e43576d 100644
--- a/docs/5-fetching.md
+++ b/docs/5-fetching.md
@@ -70,7 +70,7 @@ export default async function Page({ params }: Props) {
const { slug } = await params;
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
- graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
+ graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
});
const content = await client.getContentByPath(`/${slug.join('/')}/`);
diff --git a/docs/6-rendering-react.md b/docs/6-rendering-react.md
index e2a4a9be..cad41beb 100644
--- a/docs/6-rendering-react.md
+++ b/docs/6-rendering-react.md
@@ -167,7 +167,7 @@ export default async function Page({ params }: Props) {
const { slug } = await params;
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
- graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
+ graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
});
const content = await client.getContentByPath(`/${slug.join('/')}/`);
diff --git a/samples/fx-integration/.env.in b/samples/fx-integration/.env.in
new file mode 100644
index 00000000..f25808e5
--- /dev/null
+++ b/samples/fx-integration/.env.in
@@ -0,0 +1,23 @@
+# Base URL of your CMS instance
+# Example: https://example.cms.optimizely.com/
+OPTIMIZELY_CMS_URL=
+
+# Content Graph endpoint (optional)
+# Use to specify a non-production instance or different version
+# Default: https://cg.optimizely.com/content/v2
+OPTIMIZELY_GRAPH_GATEWAY=
+
+# Content Graph authentication key
+# Found in: CMS instance > Settings > API Keys
+OPTIMIZELY_GRAPH_SINGLE_KEY=
+
+# CLI client credentials for syncing manifest data
+# Create in: CMS instance > Settings > API Keys > Create API key
+OPTIMIZELY_CMS_CLIENT_ID=
+OPTIMIZELY_CMS_CLIENT_SECRET=
+
+# Feature Experimentation credentials
+OPTIMIZELY_FX_SDK_KEY=
+OPTIMIZELY_FX_ACCESS_TOKEN=
+
+
diff --git a/samples/fx-integration/.gitignore b/samples/fx-integration/.gitignore
index 1ec5eb93..45c45c9d 100644
--- a/samples/fx-integration/.gitignore
+++ b/samples/fx-integration/.gitignore
@@ -32,6 +32,7 @@ yarn-error.log*
# env files (can opt-in for committing if needed)
.env*
+!.env.in
# vercel
.vercel
diff --git a/samples/fx-integration/README.md b/samples/fx-integration/README.md
index 4c8332cd..4dca21c1 100644
--- a/samples/fx-integration/README.md
+++ b/samples/fx-integration/README.md
@@ -9,7 +9,7 @@ You need a Optimizely CMS instance and Optimizely Feature Experimentation instan
Create an `.env` file with the following content. You will learn how to get the values for the variables in the next steps.
```
-OPTIMIZELY_CMS_HOST=
+OPTIMIZELY_CMS_URL=
OPTIMIZELY_GRAPH_SINGLE_KEY=
OPTIMIZELY_CMS_CLIENT_ID=
OPTIMIZELY_CMS_CLIENT_SECRET=
@@ -20,7 +20,7 @@ OPTIMIZELY_FX_ACCESS_TOKEN=
### CMS credentials
-1. Put the URL of your CMS as the `OPTIMIZELY_CMS_HOST` variable. For example `https://app-1234.cms.optimizely.com/`
+1. Put the URL of your CMS as the `OPTIMIZELY_CMS_URL` variable. For example `https://app-1234.cms.optimizely.com/`
2. Go to your CMS instance → Settings → API Keys.
3. Under **Render Content**, the _Single Key_ variable, is the variable `OPTIMIZELY_GRAPH_SINGLE_KEY`
4. In the same page, under **Manage Content**, click "Create API key".
diff --git a/samples/fx-integration/src/app/en/[...slug]/page.tsx b/samples/fx-integration/src/app/en/[...slug]/page.tsx
index 75e64f3f..06d79531 100644
--- a/samples/fx-integration/src/app/en/[...slug]/page.tsx
+++ b/samples/fx-integration/src/app/en/[...slug]/page.tsx
@@ -23,7 +23,7 @@ export default async function Page({ params }: Props) {
const variation = await getVariation(path);
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
- graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
+ graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
});
if (!variation) {
diff --git a/samples/fx-integration/src/app/preview/page.tsx b/samples/fx-integration/src/app/preview/page.tsx
index bd89f2e3..13111aa5 100644
--- a/samples/fx-integration/src/app/preview/page.tsx
+++ b/samples/fx-integration/src/app/preview/page.tsx
@@ -9,7 +9,7 @@ type Props = {
export default async function Page({ searchParams }: Props) {
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
- graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
+ graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
});
const response = await client
@@ -26,7 +26,7 @@ export default async function Page({ searchParams }: Props) {
return (
<>
diff --git a/samples/graph-webhooks-cache-invalidation/.env.in b/samples/graph-webhooks-cache-invalidation/.env.in
new file mode 100644
index 00000000..e843f2ca
--- /dev/null
+++ b/samples/graph-webhooks-cache-invalidation/.env.in
@@ -0,0 +1,21 @@
+# Base URL of your CMS instance
+# Example: https://example.cms.optimizely.com/
+OPTIMIZELY_CMS_URL=
+
+# Content Graph endpoint (optional)
+# Use to specify a non-production instance or different version
+# Default: https://cg.optimizely.com/content/v2
+OPTIMIZELY_GRAPH_GATEWAY=
+
+# Content Graph authentication key
+# Found in: CMS instance > Settings > API Keys
+OPTIMIZELY_GRAPH_SINGLE_KEY=
+
+# CLI client credentials for syncing manifest data
+# Create in: CMS instance > Settings > API Keys > Create API key
+OPTIMIZELY_CMS_CLIENT_ID=
+OPTIMIZELY_CMS_CLIENT_SECRET=
+
+# Feature Experimentation credentials
+OPTIMIZELY_FX_SDK_KEY=
+OPTIMIZELY_FX_ACCESS_TOKEN=
diff --git a/samples/graph-webhooks-cache-invalidation/.gitignore b/samples/graph-webhooks-cache-invalidation/.gitignore
index 5ef6a520..ed43e1a4 100644
--- a/samples/graph-webhooks-cache-invalidation/.gitignore
+++ b/samples/graph-webhooks-cache-invalidation/.gitignore
@@ -32,6 +32,7 @@ yarn-error.log*
# env files (can opt-in for committing if needed)
.env*
+!.env.in
# vercel
.vercel
diff --git a/samples/graph-webhooks-cache-invalidation/src/app/webhooks/[id]/route.ts b/samples/graph-webhooks-cache-invalidation/src/app/webhooks/[id]/route.ts
index 08ccb948..262c00c8 100644
--- a/samples/graph-webhooks-cache-invalidation/src/app/webhooks/[id]/route.ts
+++ b/samples/graph-webhooks-cache-invalidation/src/app/webhooks/[id]/route.ts
@@ -20,7 +20,7 @@ async function revalidateDocId(docId: string) {
// but to search in Graph, we need only the UUID without separation dashes `-`
const id = docId.split('_')[0].replaceAll('-', '');
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
- graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
+ graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
});
const getPathQuery = `
diff --git a/samples/hello-world/.env.in b/samples/hello-world/.env.in
new file mode 100644
index 00000000..e843f2ca
--- /dev/null
+++ b/samples/hello-world/.env.in
@@ -0,0 +1,21 @@
+# Base URL of your CMS instance
+# Example: https://example.cms.optimizely.com/
+OPTIMIZELY_CMS_URL=
+
+# Content Graph endpoint (optional)
+# Use to specify a non-production instance or different version
+# Default: https://cg.optimizely.com/content/v2
+OPTIMIZELY_GRAPH_GATEWAY=
+
+# Content Graph authentication key
+# Found in: CMS instance > Settings > API Keys
+OPTIMIZELY_GRAPH_SINGLE_KEY=
+
+# CLI client credentials for syncing manifest data
+# Create in: CMS instance > Settings > API Keys > Create API key
+OPTIMIZELY_CMS_CLIENT_ID=
+OPTIMIZELY_CMS_CLIENT_SECRET=
+
+# Feature Experimentation credentials
+OPTIMIZELY_FX_SDK_KEY=
+OPTIMIZELY_FX_ACCESS_TOKEN=
diff --git a/samples/hello-world/.gitignore b/samples/hello-world/.gitignore
index 5ef6a520..ed43e1a4 100644
--- a/samples/hello-world/.gitignore
+++ b/samples/hello-world/.gitignore
@@ -32,6 +32,7 @@ yarn-error.log*
# env files (can opt-in for committing if needed)
.env*
+!.env.in
# vercel
.vercel
diff --git a/samples/hello-world/src/app/[...slug]/page.tsx b/samples/hello-world/src/app/[...slug]/page.tsx
index 80100d5f..396a9359 100644
--- a/samples/hello-world/src/app/[...slug]/page.tsx
+++ b/samples/hello-world/src/app/[...slug]/page.tsx
@@ -13,7 +13,7 @@ export default async function Page({ params }: Props) {
const { slug } = await params;
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
- graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
+ graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
});
const content = await client.getContentByPath(`/${slug.join('/')}/`);
diff --git a/samples/hello-world/src/app/preview/page.tsx b/samples/hello-world/src/app/preview/page.tsx
index d2d8eef4..6da6d616 100644
--- a/samples/hello-world/src/app/preview/page.tsx
+++ b/samples/hello-world/src/app/preview/page.tsx
@@ -9,7 +9,7 @@ type Props = {
export default async function Page({ searchParams }: Props) {
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
- graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
+ graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
});
const response = await client.getPreviewContent(
@@ -19,7 +19,7 @@ export default async function Page({ searchParams }: Props) {
return (
<>
diff --git a/samples/nextjs-template/.env.example b/samples/nextjs-template/.env.example
deleted file mode 100644
index 5071accc..00000000
--- a/samples/nextjs-template/.env.example
+++ /dev/null
@@ -1,16 +0,0 @@
-# Key to fetch content from the CMS.
-# To get the key go to your CMS instance > Settings > API Keys
-OPTIMIZELY_GRAPH_SINGLE_KEY=''
-
-# Client ID and Secret from your CMS instance
-# Go to your CMS instance > Settings > API Keys and click "Create API key"
-OPTIMIZELY_CMS_CLIENT_ID=
-OPTIMIZELY_CMS_CLIENT_SECRET=
-
-# Root CMS instance. For example "https://.cms.optimizely.com"
-OPTIMIZELY_CMS_HOST=
-# From here, all environmental variables are optional
-#
-# Endpoint of GraphQL. Use this variable if you use a non-production instance or a different version
-# OPTIMIZELY_GRAPH_URL=https://cg.optimizely.com/content/v2
-#
diff --git a/samples/nextjs-template/.env.in b/samples/nextjs-template/.env.in
new file mode 100644
index 00000000..e843f2ca
--- /dev/null
+++ b/samples/nextjs-template/.env.in
@@ -0,0 +1,21 @@
+# Base URL of your CMS instance
+# Example: https://example.cms.optimizely.com/
+OPTIMIZELY_CMS_URL=
+
+# Content Graph endpoint (optional)
+# Use to specify a non-production instance or different version
+# Default: https://cg.optimizely.com/content/v2
+OPTIMIZELY_GRAPH_GATEWAY=
+
+# Content Graph authentication key
+# Found in: CMS instance > Settings > API Keys
+OPTIMIZELY_GRAPH_SINGLE_KEY=
+
+# CLI client credentials for syncing manifest data
+# Create in: CMS instance > Settings > API Keys > Create API key
+OPTIMIZELY_CMS_CLIENT_ID=
+OPTIMIZELY_CMS_CLIENT_SECRET=
+
+# Feature Experimentation credentials
+OPTIMIZELY_FX_SDK_KEY=
+OPTIMIZELY_FX_ACCESS_TOKEN=
diff --git a/samples/nextjs-template/.gitignore b/samples/nextjs-template/.gitignore
index 69b4ab80..c89fa69a 100644
--- a/samples/nextjs-template/.gitignore
+++ b/samples/nextjs-template/.gitignore
@@ -33,6 +33,7 @@ yarn-error.log*
# env files (can opt-in for committing if needed)
.env*
!.env.example
+!.env.in
# vercel
.vercel
diff --git a/samples/nextjs-template/src/app/[...slug]/page.tsx b/samples/nextjs-template/src/app/[...slug]/page.tsx
index 7409dc9c..a4d7f061 100644
--- a/samples/nextjs-template/src/app/[...slug]/page.tsx
+++ b/samples/nextjs-template/src/app/[...slug]/page.tsx
@@ -13,7 +13,7 @@ export default async function Page({ params }: Props) {
const { slug } = await params;
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
- graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
+ graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
});
const c = await client.getContentByPath(`/${slug.join('/')}/`);
diff --git a/samples/nextjs-template/src/app/preview/page.tsx b/samples/nextjs-template/src/app/preview/page.tsx
index 3c97d91f..13fe1363 100644
--- a/samples/nextjs-template/src/app/preview/page.tsx
+++ b/samples/nextjs-template/src/app/preview/page.tsx
@@ -9,7 +9,7 @@ type Props = {
export default async function Page({ searchParams }: Props) {
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
- graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
+ graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
});
const response = await client.getPreviewContent(
@@ -20,7 +20,7 @@ export default async function Page({ searchParams }: Props) {
return (
<>