Environment Variables
Grafbase supports the use of environment variables inside of the file schema.graphql
.
Inside of your local grafbase
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, g } from '@grafbase/sdk'
const provider = auth.OpenIDConnect({
issuer: '{{ env.ISSUER_URL }}'
})
export default config({
schema: g,
auth: {
providers: [provider]
}
})
In production these will read from your Grafbase project settings, but locally you'll want to set these to read from your local grafbase/.env
file:
ISSUER_URL=https://...
Learn more about environment variables.