Skip to content

Env variables

When you create new project, you can find .env-example file in the root of the project. This file contains some default ENV variables which you should give values to in order for project to work.

In this guide we will go through each one of them and see what they are used for.

txt
NUXT_API_URL=""
NUXT_PUBLIC_ENVIRONMENT="local"

# SENTRY
NUXT_PUBLIC_SENTRY_DSN=""
NUXT_SENTRY_AUTH_TOKEN=""
NUXT_SENTRY_URL=""

# AUTH
NUXT_SESSION_PASSWORD=""
NUXT_OAUTH_GOOGLE_CLIENT_ID=""
NUXT_OAUTH_GOOGLE_CLIENT_SECRET=""

First rename the file to .env so that Nuxt registers it. Each of the ENV variables should start with NUXT_ prefix. For more details on working with ENV variables please refer to Nuxt docs.

NUXT_API_URL

This variable is base URL of the API for fetching data in server routes.

NUXT_PUBLIC_ENVIRONMENT

Possible values: local | staging | prod

Why not use test as an environment name?

Nuxt has reserved test environment name for running tests. For further information refer to Nuxt docs

This variable is used to identify current environment. This then determines things like:

  1. Enable or disable usage of Sentry and it's parameters
  2. Enable or disable usage of Google analytics and it's parameters

NUXT_PUBLIC_SENTRY_DSN

DSN of your project.

NUXT_SENTRY_AUTH_TOKEN

Generated auth token, needed to publish the logs.

NUXT_SENTRY_URL

URL of your organization in stentry.

NUXT_SESSION_PASSWORD

At least 32 characters long hash used by nuxt-auth-utils. For more details refer to Nuxt auth utils documentation.

For more details about authentication go to Authentication.

NUXT_OAUTH_GOOGLE_CLIENT_ID

UPDATE

Google provider to specific section

Your google OAuth clientId used for authentication with Google provider.

NUXT_OAUTH_GOOGLE_CLIENT_SECRET

UPDATE

Google provider to specific section

Your google OAuth client secret used for authentication with Google provider.

Made with ♥️ by Riešenia