Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit 33e6fcc

Browse files
committed
mention vercel env var setup
1 parent 3c447fa commit 33e6fcc

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

README.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ yarn
126126

127127
**Step 4: Setup ENV Variables**
128128

129-
ENV variables are like constants in `wp-config.php`. Copy the sample ENV file, then add your credentials:
129+
ENV variables are like constants in `wp-config.php`. They're required in order for authentication and 3rd party services to work.
130+
131+
Copy the [sample ENV file](https://github.com/WebDevStudios/nextjs-wordpress-starter/blob/staging/.env.sample), then modify it to match your credentials:
130132

131133
```bash
132134
cp .env.sample .env
@@ -138,28 +140,40 @@ cp .env.sample .env
138140

139141
<details>
140142

141-
The following steps require A) access to a Vercel account and B) assumes the ENV vars are already set up on Vercel. If you need access to the WDS Team account on Vercel, please reach out to Greg.
143+
The preferred workflow is to add ENV variables to Vercel first, then pull them down.
144+
145+
**Step 1: Add ENV vars to Vercel**
146+
147+
Go to:
148+
149+
```text
150+
Your Project --> Settings --> Environment Variables
151+
```
152+
153+
![vercel settings](https://dl.dropbox.com/s/7ljvynnez0c5q8y/Screen%20Shot%202021-01-29%20at%2014.07.58.png?dl=0)
142154

143-
**Step 1: Install the [Vercel CLI](https://vercel.com/download)**
155+
**Step 2: Install the [Vercel CLI](https://vercel.com/download)**
144156

145157
```bash
146158
npm i -g vercel
147159
```
148160

149-
**Step 2: Initialize Vercel**
161+
**Step 3: Initialize Vercel**
162+
163+
Answer the questions in the command line when prompted.
150164

151165
```bash
152166
vercel init
153167
```
154168

155-
Answer the questions in the command line when prompted.
156-
157-
**Step 3: Pull down the ENV variables**
169+
**Step 4: Pull down the ENV variables**
158170

159171
```bash
160172
vercel env pull
161173
```
162174

175+
Now Next.js has what it needs to talk to 3rd party services.
176+
163177
</details>
164178

165179
---
@@ -195,11 +209,11 @@ define('PREVIEW_SECRET_TOKEN', 'ANY_RANDOM_STRING');
195209

196210
**Step 4: Start the `nextjs-wp` site**
197211

198-
**Note:** Make sure your local URL matches the `LOCAL_WORDPRESS_API_URL` in the frontend `.env` file!
199-
200212
### Enable Previews
201213

202-
To enable previews, you'll need both a `PREVIEW_SECRET_TOKEN` constant in `wp-config.php` and `WORDPRESS_PREVIEW_SECRET` ENV variable in `.env`. The token can be any random string so long as they match.
214+
To enable previews, you'll need both a `PREVIEW_SECRET_TOKEN` constant in `wp-config.php` and `WORDPRESS_PREVIEW_SECRET` ENV variable in `.env`.
215+
216+
The token can be any random string as long as they match.
203217

204218
---
205219

0 commit comments

Comments
 (0)