Back
App Hosting

Set environment variables

Configure app settings and secrets on a Victus App Hosting server using Startup variables in the panel, plus how to read them from your code and when a restart is needed.

environment variablesenvstartupsecretsconfigapp hosting

Environment variables are the clean way to configure an app without editing code — database credentials, API keys, ports and feature flags. On Victus, each server exposes its configurable variables in the Startup tab of the control panel. The egg defines which variables exist; you fill in the values.

Edit variables in the panel

  1. 1Open your server in the control panel and go to the Startup tab.
  2. 2Each field maps to an environment variable (for example PASSWORD, PORT, or a token).
  3. 3Enter your values and save.
  4. 4Restart the server from the Console for the new values to take effect.

Changes need a restart

Startup variables are injected when the process launches. Editing a value while the server is running does nothing until you Restart (or Stop then Start) from the Console.

App-defined variables via a file

If your framework expects variables the egg does not list (for example a custom Laravel or Node app), keep them in a .env file that you create in the Files tab. Load it at startup with a library like dotenv (Node/Python) — frameworks such as Laravel read .env automatically.

bash
# .env in your project root (Files tab)
DB_HOST=your-db-host
DB_PORT=3306
DB_NAME=your_db
DB_USER=your_user
DB_PASSWORD=super-secret
APP_ENV=production

Read them in code

javascript
// Node.js
import 'dotenv/config';
const port = process.env.PORT || 3000;
const dbUrl = process.env.DB_HOST;

Never expose secrets

Keep .env files out of the public web root and out of any git repo you push. A token committed to a public repo is a leaked token — rotate it immediately if that happens.