Skip to content

Commit

Permalink
Merge pull request #129 from gatsbyjs/chore/update-sanity-env-var-naming
Browse files Browse the repository at this point in the history
update sanity env vars to match expected convention in cloud
  • Loading branch information
aghreed committed Jul 12, 2022
1 parent aa2f2bb commit 6b4284b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .env.EXAMPLE
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# with the following keys.
# Do NOT check these files into source control
SANITY_PROJECT_ID=""
SANITY_DATASET=""
SANITY_TOKEN=""
SANITY_PROJECT_DATASET=""
SANITY_READ_TOKEN=""
4 changes: 2 additions & 2 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ module.exports = {
resolve: "gatsby-source-sanity",
options: {
projectId: process.env.SANITY_PROJECT_ID,
dataset: process.env.SANITY_DATASET,
token: process.env.SANITY_TOKEN,
dataset: process.env.SANITY_PROJECT_DATASET,
token: process.env.SANITY_READ_TOKEN,
},
},
"gatsby-plugin-sharp",
Expand Down
8 changes: 4 additions & 4 deletions scripts/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const config = new Configstore(
globalConfigPath: true,
}
)
const token = process.env.SANITY_TOKEN || config.get("authToken")
const dataset = process.env.SANITY_DATASET || studio.api?.dataset
const token = process.env.SANITY_READ_TOKEN || config.get("authToken")
const dataset = process.env.SANITY_PROJECT_DATASET || studio.api?.dataset
const projectId = process.env.SANITY_PROJECT_ID || studio.api?.projectId

if (!token) {
Expand All @@ -29,9 +29,9 @@ const content = [
`# All environment variables will be sourced`,
`# and made available to gatsby-config.js, gatsby-node.js, etc.`,
`# Do NOT commit this file to source control`,
`SANITY_TOKEN='${token}'`,
`SANITY_READ_TOKEN='${token}'`,
`SANITY_PROJECT_ID='${projectId}'`,
`SANITY_DATASET='${dataset}'`,
`SANITY_PROJECT_DATASET='${dataset}'`,
].join("\n")

fs.writeFileSync(".env.development", content)
Expand Down

0 comments on commit 6b4284b

Please sign in to comment.