The environment variables below allow you to configure features of Gatsby Cloud:
-
NODE_VERSION
: Specify the version of Node.js your project should use. For example,NODE_VERSION=10
. Defaults to14
. -
NPM_TOKEN
: Use to access private npm modules. -
NPM_REGISTRY
: Use to set the URL of a private registry. -
YARN_FLAGS
: Flags that are passed through to theyarn
command. -
NODE_OPTIONS
: Passed through as options for Node.js. For example,NODE_OPTIONS=--max-old-space-size=4096
. -
PREFIX_PATHS
: Set totrue
to enable the--prefix-paths
flag duringgatsby build
. See the docs on prefix-paths. -
REACT_PROFILE
: Set totrue
or1
to enable the--profile
flag duringgatsby build
. See the docs on using the profiler.
Read-only variables
These variables are pre-defined for both Builds and Preview environments. They are set automatically and cannot be changed. You can reference them in your gatsby-config.js
or anywhere else you would normally reference an environment variable.
-
BRANCH
: The name of the current git branch. Useful for swapping environment variables depending on the branch. -
COMMIT_REF
: The commit SHA that the build is building off of. Can be used with tools like Sentry for creating unique deployment IDs. -
CI
: Alwaystrue
. -
GATSBY_CLOUD
: Alwaystrue
. Useful for checking if your build is running on Gatsby Cloud. -
GATSBY_IS_PREVIEW
:true
only in the CMS Preview environment, for both legacy preview builder and incremental preview builder. -
NODE_ENV
:- is
production
for Production Builds and Pull Request Builds - is
development
for CMS Previews which use the legacy preview builder - is
production
for CMS Previews that use the new incremental preview builder - Regardless of the environment variable value, CMS Preview builds still use preview data
- is
Comments
0 comments
Please sign in to leave a comment.