Skip to main content
Panel startup variables are visible to anyone with access to your server’s configuration. For secrets like API keys, database URLs, or third-party credentials, use env injection instead: upload a .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.
Do not name the file .env directly. The egg looks specifically for .env.pterodactyl. Uploading a file named .env will not trigger the copy step.

Steps

1

Create your .env file locally

Create a .env file on your machine with all the environment variables your app requires:
.env
DATABASE_URL=postgres://user:pass@host:5432/db
NEXTAUTH_SECRET=your-secret-here
NEXT_PUBLIC_API_URL=https://api.example.com
2

Rename the file

Rename the file from .env to .env.pterodactyl. The name must match exactly.
3

Open the File Manager

In the panel, open the File Manager for your server and navigate to /home/container/.
4

Upload the file

Upload .env.pterodactyl to /home/container/. If a file with that name already exists, replace it.
5

Restart the server

Restart the server. The egg copies .env.pterodactyl to .env automatically before running npm install and next build.
If you update your environment variables, re-upload .env.pterodactyl and restart the server. The egg overwrites .env on every startup.