.env.pterodactyl file through the File Manager and the egg copies it to .env before the app starts.
The copy happens before
npm install and next build, so environment variables are available at both install time and build time.How it works
At startup, the egg checks for a file named.env.pterodactyl in /home/container/. If it exists, the egg copies it to /home/container/.env before installing dependencies or running the build. Your Next.js app reads the resulting .env file as normal.
Steps
Create your .env file locally
Create a
.env file on your machine with all the environment variables your app requires:.env
Open the File Manager
In the panel, open the File Manager for your server and navigate to
/home/container/.Upload the file
Upload
.env.pterodactyl to /home/container/. If a file with that name already exists, replace it.