Environment Variables

Grafbase supports the use of environment variables inside of the file grafbase.config.ts.

Inside of your project folder you can create the file .env that contains the key/value pairs that match those used inside of your schema.

Here we can have a schema with the OIDC issuer URL set as an environment variable:

import { auth, config, graph } from '@grafbase/sdk' const g = graph.Standalone() const provider = auth.OpenIDConnect({ issuer: '{{ env.ISSUER_URL }}', }) export default config({ graph: g, auth: { providers: [provider], }, })

In production these will read from your project settings, but locally you'll want to set these to read from your local .env file:


Learn more about environment variables.

Was this page helpful?