Environment Variables are key-value pairs used to store configuration settings and parameters, influencing the behavior and settings of your services at runtime.

Here is how you would access an environment variable, MY_NHOST_CONFIG, from a function:

functions/print-env.ts
import { Request, Response } from 'express'

export default (req: Request, res: Response) => {
  res.status(200).send(`${process.env.MY_NHOST_CONFIG} ${req.query.name}!`)
}

Variables created are available to all services, including Run Services and Functions

Adding Environment Variables

  • Config

  • Dashboard

[[global.environment]]
name = 'MY_NHOST_CONFIG'
value = "Nhost is Awesome!"

System Environment Variables

System environment variables are generated and managed by Nhost. The following variables are available:

  • NHOST_ADMIN_SECRET
  • NHOST_WEBHOOK_SECRET
  • NHOST_SUBDOMAIN
  • NHOST_REGION
  • NHOST_HASURA_URL
  • NHOST_AUTH_URL
  • NHOST_GRAPHQL_URL
  • NHOST_STORAGE_URL
  • NHOST_FUNCTIONS_URL
  • NHOST_JWT_SECRET

NHOST_ADMIN_SECRET, NHOST_WEBHOOK_SECRET and NHOST_JWT_SECRET are populated with values from their corresponding secrets.

Example values:

NHOST_ADMIN_SECRET={{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}

NHOST_WEBHOOK_SECRET={{ secrets.NHOST_WEBHOOK_SECRET }}

NHOST_SUBDOMAIN=abv123abc

NHOST_REGION=eu-central-1

NHOST_HASURA_URL=https://abc123abc.hasura.eu-central-1.nhost.run/console

NHOST_AUTH_URL=https://abc123abc.auth.eu-central-1.nhost.run/v1

NHOST_GRAPHQL_URL=https://abc123abc.graphql.eu-central-1.nhost.run/v1

NHOST_STORAGE_URL=https://abc123abc.storage.eu-central-1.nhost.run/v1

NHOST_FUNCTIONS_URL=https://abc123abc.functions.eu-central-1.nhost.run/v1

NHOST_JWT_SECRET={"key": "{{ secrets.HASURA_GRAPHQL_JWT_SECRET }}", "type": "HS256" }