Environment Variables
Last updated
Last updated
Next.js has built-in support for loading environment variables from .env
file into process.env
.
An example .env
:
You can generate a new .env locally which will also generate a random Next auth secret and encryption secret by running the following command:
You will then need to go to your new .env file and paste in your Asset Layer app ID and app secret.
This loads process.env.ASSETLAYER_URL
, process.env.ASSETLAYER_APP_ID
, andprocess.env.ASSETLAYER_APP_SECRET
into the Node.js environment automatically allowing you to use them in Next.js data fetching methods and API routes.
In order for your Sample App to work properly once deployed, you need to setup the Environment Variables on the server.
Read more about environment variables here.