Environment Variables

Configuration variables for Next.js and Drupal.


.env.local

# Basic
NEXT_DRUPAL_BASE_URL=https://backend.vactory.lecontenaire.com
NEXT_BASE_URL=https://vactory.lecontenaire.com
NEXT_IMAGE_DOMAIN=vactory.lecontenaire.com
# Redis Cache
REDIS_PREFIX=vactory
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_USERNAME=default
REDIS_PASSWORD=eYVX7EwVmmxKPCDmwMtyKVge8oLd2t81
# Authentication
NEXTAUTH_URL=https://vactory.lecontenaire.com
NEXTAUTH_SECRET=123456
JWT_SIGNING_PRIVATE_KEY={"kty":"oct","kid":"o5rYv_twJF3n2nEvsKtYoQmlFX0TO48P7hh_cSVjLBk","alg":"HS512","k":"j_MX1m1k8HFX6qZENRwDcx5Uay2WGQrN_LkQ9VdCnSj7dx0QlUajvx0WMImBgzsy17pI69KENB4cs7RtSLylJQ"}%
# Authentication (OAuth Provider)
OAUTH_CLIENT_ID=57a079aa-06e4-4725-9b38-49722901468e
OAUTH_CLIENT_SECRET=123456
# Authentication (Keycloak Provider)
KEYCLOAK_ID=keycloak
KEYCLOAK_SECRET=
KEYCLOAK_ISSUER=
# ReCaptcha
NEXT_RECAPTCHA_SITEKEY=6LdccOUeAAAAAKnRDy2yPKLc9YAy-Jn-CdKhrjUm
RECAPTCHA_SECRETKEY=6LdccOUeAAAAAHKQlW3f3B5khCjx0B5rBFZTN7P1
# Cache invalidation
CACHE_SECRET=4467543228
# Debug mode for fetch
DRUPAL_CLIENT_DEBUG=TRUE

Basic

These environment variables are required to connect to Drupal.

NameDescription
NEXT_DRUPAL_BASE_URLThe base url for your Drupal site. Example: http://localhost:8080
NEXT_BASE_URLThe base url for your Next.js site. Example: http://localhost
NEXT_IMAGE_DOMAINThe domain name for next/image. Example: localhost

Redis Cache

Environment variables required for redis cache.

NameDescription
REDIS_HOSTCan be a host, or the path to a unix domain socket.
REDIS_PORTDefault is 6379, should be -1 for unix domain socket
REDIS_USERNAMEDefault is default
REDIS_PASSWORDDefault is eYVX7EwVmmxKPCDmwMtyKVge8oLd2t81
REDIS_PREFIXUsed as a prefix to the Redis key
import Client from "ioredis"
const redis = new Client({
port: process.env.REDIS_PORT,
host: process.env.REDIS_HOST,
username: process.env.REDIS_USERNAME, // needs Redis >= 6
password: process.env.REDIS_PASSWORD,
keyPrefix: process.env.REDIS_PREFIX,
db: 0, // Defaults to 0
})

Authentication

Using OAuth Password Grant.

NameDescription
OAUTH_CLIENT_IDDrupal OAuth Client ID. See www.drupal.org/project/simple_oauth
OAUTH_CLIENT_SECRETDrupal OAuth Client Secret. See www.drupal.org/project/simple_oauth

Authentication (OAuth Provider)

NameDescription
KEYCLOAK_IDKeycloak OAuth Client ID
KEYCLOAK_SECRETKeycloak OAuth Client Secret.
KEYCLOAK_ISSUERKeycloak Issuer URL

ReCaptcha

NameDescription
NEXT_RECAPTCHA_SITEKEYReCaptcha site key. See https://www.google.com/recaptcha/
RECAPTCHA_SECRETKEYReCaptcha site secret key. See https://www.google.com/recaptcha/

Cache Invalidation

NameDescription
CACHE_SECRETGrant access to /api/cache/clear, Example 4467543228, Curl POST /api/cache/clear -H x-cache-secret=4467543228

Drupal Client

NameDescription
DRUPAL_CLIENT_DEBUGIf defined, the drupal client will start logging debug informations