Gatsby .env variables
Veröffentlicht am: 13. März 2020
Lesedauer: 1 Min.
// gatsby-config.js
require("dotenv").config({
path: `.env.${process.env.NODE_ENV}`,
})
create 2 files in root folder
.env.development .env.production
Gatsby automatically detects in which environment the website is running. So it automatically extracts the .env variables from either the .env.development or .env.production file.
Example .env key-value-pair CONTENTFULACCESSTOKEN=yourrandomkey
Articles in related Categories
18. März 2020
16. April 2020
16. April 2020