Skip to content

Commit 37eef4b

Browse files
authored
Merge pull request #165 from episerver/feature/CMS-44989-unify-env-variables
CMS-44989 Update environment variable names and improve documentation for configuration.
2 parents 192fd3c + 3b07025 commit 37eef4b

File tree

29 files changed

+138
-42
lines changed

29 files changed

+138
-42
lines changed

.github/workflows/vercel-preview.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ env:
33
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
44
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
55
OPTIMIZELY_GRAPH_SINGLE_KEY: ${{ secrets.OPTIMIZELY_GRAPH_SINGLE_KEY }}
6-
OPTIMIZELY_CMS_HOST: ${{ secrets.OPTIMIZELY_CMS_HOST }}
7-
OPTIMIZELY_GRAPH_URL: ${{ secrets.OPTIMIZELY_GRAPH_URL }}
6+
OPTIMIZELY_CMS_URL: ${{ secrets.OPTIMIZELY_CMS_URL }}
7+
OPTIMIZELY_GRAPH_GATEWAY: ${{ secrets.OPTIMIZELY_GRAPH_GATEWAY }}
88
on:
99
push:
1010
branches-ignore:

.github/workflows/vercel-prod.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ env:
33
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
44
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
55
OPTIMIZELY_GRAPH_SINGLE_KEY: ${{ secrets.OPTIMIZELY_GRAPH_SINGLE_KEY }}
6-
OPTIMIZELY_CMS_HOST: ${{ secrets.OPTIMIZELY_CMS_HOST }}
7-
OPTIMIZELY_GRAPH_URL: ${{ secrets.OPTIMIZELY_GRAPH_URL }}
6+
OPTIMIZELY_CMS_URL: ${{ secrets.OPTIMIZELY_CMS_URL }}
7+
OPTIMIZELY_GRAPH_GATEWAY: ${{ secrets.OPTIMIZELY_GRAPH_GATEWAY }}
88
on:
99
push:
1010
branches:

__test__/test-website/.env.in

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Base URL of your CMS instance
2+
# Example: https://example.cms.optimizely.com/
3+
OPTIMIZELY_CMS_URL=
4+
5+
# Content Graph endpoint (optional)
6+
# Use to specify a non-production instance or different version
7+
# Default: https://cg.optimizely.com/content/v2
8+
OPTIMIZELY_GRAPH_GATEWAY=
9+
10+
# Content Graph authentication key
11+
# Found in: CMS instance > Settings > API Keys
12+
OPTIMIZELY_GRAPH_SINGLE_KEY=
13+
14+
# CLI client credentials for syncing manifest data
15+
# Create in: CMS instance > Settings > API Keys > Create API key
16+
OPTIMIZELY_CMS_CLIENT_ID=
17+
OPTIMIZELY_CMS_CLIENT_SECRET=
18+
19+
# Feature Experimentation credentials
20+
OPTIMIZELY_FX_SDK_KEY=
21+
OPTIMIZELY_FX_ACCESS_TOKEN=

__test__/test-website/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ yarn-error.log*
3232

3333
# env files (can opt-in for committing if needed)
3434
.env*
35+
!.env.in
3536

3637
# vercel
3738
.vercel

__test__/test-website/src/app/all/[...slug]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default async function Page({ params }: Props) {
1414
const { slug } = await params;
1515

1616
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
17-
graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
17+
graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
1818
});
1919

2020
const content = await client.getContentByPath(`/${slug.join('/')}/`);

__test__/test-website/src/app/en/[...slug]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default async function Page({ params, searchParams }: Props) {
3232
const path = `/en/${slug.join('/')}/`;
3333

3434
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
35-
graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
35+
graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
3636
});
3737

3838
const variation = (await searchParams).variation;

__test__/test-website/src/app/missing-content-types/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ export default async function Page({ searchParams }: Props) {
1717
const { path } = await searchParams;
1818

1919
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
20-
graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
20+
graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
2121
});
22-
const c = await client.fetchContent(path);
22+
const c = await client.getContentByPath(path);
2323

2424
return <pre>{c}</pre>;
2525
}

__test__/test-website/src/app/multi-host/[...slug]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default async function Page({ params }: Props) {
1414
const { slug } = await params;
1515

1616
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
17-
graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
17+
graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
1818
});
1919
const host =
2020
process.env.NEXTJS_HOST ?? `https://localhost:${process.env.PORT ?? 3000}`;

__test__/test-website/src/app/preview/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type Props = {
99

1010
export default async function Page({ searchParams }: Props) {
1111
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
12-
graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
12+
graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
1313
});
1414

1515
const response = await client
@@ -30,7 +30,7 @@ export default async function Page({ searchParams }: Props) {
3030
return (
3131
<>
3232
<Script
33-
src={`${process.env.OPTIMIZELY_CMS_HOST}/util/javascript/communicationinjector.js`}
33+
src={`${process.env.OPTIMIZELY_CMS_URL}/util/javascript/communicationinjector.js`}
3434
></Script>
3535
<PreviewComponent />
3636
<OptimizelyComponent opti={response} />

__test__/test-website/src/app/related/[...slug]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default async function Page({ params }: Props) {
1313
const { slug } = await params;
1414

1515
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
16-
graphUrl: process.env.OPTIMIZELY_GRAPH_URL,
16+
graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
1717
});
1818

1919
const children = (await client.getItems(`/${slug.join('/')}`)) ?? [];

0 commit comments

Comments
 (0)