Skip to content

Commit

Permalink
[cms-sanity] Allow environment configurable dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Oct 22, 2020
1 parent 585ee90 commit 7460aa8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion examples/cms-sanity/.env.local.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
NEXT_PUBLIC_SANITY_PROJECT_ID=
NEXT_PUBLIC_SANITY_DATASET=
SANITY_API_TOKEN=
SANITY_PREVIEW_SECRET=
SANITY_PREVIEW_SECRET=
1 change: 1 addition & 0 deletions examples/cms-sanity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Your `.env.local` file should look like this:

```bash
NEXT_PUBLIC_SANITY_PROJECT_ID=...
NEXT_PUBLIC_SANITY_DATASET=...
SANITY_API_TOKEN=...
SANITY_PREVIEW_SECRET=...
```
Expand Down
2 changes: 1 addition & 1 deletion examples/cms-sanity/lib/sanity.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {

const options = {
// Find your project ID and dataset in `sanity.json` in your studio project
dataset: 'production',
dataset: process.env.NEXT_PUBLIC_SANITY_DATASET || 'production',
projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID,
useCdn: process.env.NODE_ENV === 'production',
// useCdn == true gives fast, cheap responses using a globally distributed cache.
Expand Down

0 comments on commit 7460aa8

Please sign in to comment.