Environment Variables

July 17, 2021 ยท View on GitHub

We use environment variables for configuration and storing secret credentials. They are set by the production / test servers and CI environments and can also be set locally; the easiest way is to edit the (gitignored) .env file in the project's root directory:

MY_ENV_VARIABLE=hello

# Lines beginning with # are comments
NODE_ENV=production

Every script that uses environment variables must import lib/load-env-file.js as the very first statement.

Please update these docs and cli/debug-env-variables.js after introducing new variables.

Environment variables used by OFL

NamePossible valuesDescription
ALLOW_SEARCH_INDEXINGallowed or anything elseIf the value is not allowed, a <meta> tag is added to tell search engines not to index the page. (This is only allowed in the production deployment)
GITHUB_USER_TOKENA 40-char GitHub access tokenUsed to create pull request when adding fixtures and create/delete comments after running GitHub tests
GITHUB_BROKEN_LINKS_ISSUE_NUMBERA GitHub issue numberUsed by tests/external-links.js
NODE_ENVproduction or development (default)Introduced by Express.js, production enables caching, minimizing and more optimizations improving the performance a lot.
PORTA free port numberOn which port to start the Nuxt.js server, defaults to 3000.
HOSTA host name or IP addressOn which host to start the Nuxt.js server, defaults to localhost.
WEBSITE_URLAn absolute URL with a trailing slash.The public URL of the website. Defaults to http://localhost:${PORT}/.
GITHUB_PR_NUMBERA GitHub pull request numberIn a pull request, the PR number.
GITHUB_PR_HEAD_REFA git refIn a pull request, the PR head ref (e.g. feature-branch).
GITHUB_PR_BASE_REFA git refIn a pull request, the PR base ref (e.g. master).
GITHUB_REPOSITORYSet by GitHub Actions
GITHUB_RUN_IDSet by GitHub Actions
GITHUB_REFSet by GitHub Actions