From b3d252e2914f75abd9fa94b4ef71814440df30f0 Mon Sep 17 00:00:00 2001 From: Martian Lee Date: Sat, 3 Sep 2022 01:41:06 +0800 Subject: [PATCH] refactor: unify name of starter variables for Vercel deployments (#186) --- .env.local.example | 2 +- .gitignore | 1 + README.md | 4 ++-- lib/_client.js | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.env.local.example b/.env.local.example index 88f13c3c..11112d1e 100644 --- a/.env.local.example +++ b/.env.local.example @@ -1 +1 @@ -NEXT_PUBLIC_GRAPHCMS_URL= +HYGRAPH_ENDPOINT= diff --git a/.gitignore b/.gitignore index ae9cd3f9..2ae73f46 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .next/ node_modules/ .vercel +.idea diff --git a/README.md b/README.md index 79e19673..84a3a0e9 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ • [Demo](https://marketing-websites.withheadlesscms.com/) [![Clone project](https://hygraph.com/button)](https://app.graphcms.com/clone/5f2c35155b33496999b9467afe88b34f?name=Marketing%20Website) -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FGraphCMS%2Freference-marketing-website&env=NEXT_PUBLIC_GRAPHCMS_URL&envDescription=Your%20GraphCMS%20API%20endpoint&envLink=https%3A%2F%2Fgraphcms.com%2Fdocs%2Fapi-reference%2Fbasics%2Fenvironments%23environment-endpoints&demo-title=GraphCMS%20Marketing%20Site%20Reference&demo-description=A%20Next.js%20starter%20for%20creating%20a%20SaaS%20Marketing%20Website%20with%20GraphCMS&demo-url=https%3A%2F%2Fmarketing-websites.withheadlesscms.com%2F&demo-image=https%3A%2F%2Fmedia.graphcms.com%2F0GnTWzWbRBSQzoDQs8R3) +[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FGraphCMS%2Freference-marketing-website&env=HYGRAPH_ENDPOINT&envDescription=Your%20GraphCMS%20API%20endpoint&envLink=https%3A%2F%2Fgraphcms.com%2Fdocs%2Fapi-reference%2Fbasics%2Fenvironments%23environment-endpoints&demo-title=GraphCMS%20Marketing%20Site%20Reference&demo-description=A%20Next.js%20starter%20for%20creating%20a%20SaaS%20Marketing%20Website%20with%20GraphCMS&demo-url=https%3A%2F%2Fmarketing-websites.withheadlesscms.com%2F&demo-image=https%3A%2F%2Fmedia.graphcms.com%2F0GnTWzWbRBSQzoDQs8R3) ## Quick start @@ -28,7 +28,7 @@ cp .env.local.example .env.local Inside of your newly created `.env.local` file, provide values for the variable. These variables can be found in the [project settings UI](https://hygraph.com/docs/guides/concepts/apis#working-with-apis). ```env -NEXT_PUBLIC_GRAPHCMS_URL= +HYGRAPH_ENDPOINT= ``` 3. **Start building!** diff --git a/lib/_client.js b/lib/_client.js index 3c9d6bd5..1cb7e6e7 100644 --- a/lib/_client.js +++ b/lib/_client.js @@ -1,7 +1,7 @@ import { GraphQLClient } from 'graphql-request' const hygraphClient = (preview = false) => - new GraphQLClient(process.env.NEXT_PUBLIC_GRAPHCMS_URL, { + new GraphQLClient(process.env.HYGRAPH_ENDPOINT, { headers: { ...(process.env.GRAPHCMS_TOKEN && { Authorization: `Bearer ${