Environment variables
Velixir injects environment variables into your app's pod at start-up. They're set per-app from the dashboard or the CLI (CLI support coming soon - for now use the dashboard) and applied on the next deploy.
Setting a variable
From the app's Environment tab:
- Enter a key (
DATABASE_URL,STRIPE_API_KEY, anything matching^[A-Z_][A-Z0-9_]*$). - Enter a value.
- Tick Treat as secret if it's something you don't want shown back in the UI.
- Click Save.
Setting a key that already exists replaces its value. No separate "edit" step.
Secrets vs plain values
- Plain values are stored as you typed them and shown back in the UI. Use these for non-sensitive config: feature flags, hostnames, environment names.
- Secrets are encrypted at rest with ASP.NET Core DataProtection (the same key infrastructure that signs cookies and antiforgery tokens). The UI shows
••••••••instead of the value; to change a secret you set the key again with a new value.
Both kinds reach your pod as ordinary environment variables, so your code reads them however your language normally does. Nothing Velixir-specific is required.
Reading them from your code
Environment variables are read the standard way in every language, no Velixir SDK required:
// Node.js
const dbUrl = process.env.DATABASE_URL;
const port = process.env.PORT;
// .NET
var dbUrl = Environment.GetEnvironmentVariable("DATABASE_URL");
var port = Environment.GetEnvironmentVariable("PORT");
We also set some platform-managed vars automatically:
PORT- the port your app must listen on. This is the one variable every app has to honour, whatever language it's written in: bind your web server to it.VELIXIR_APP_ID,VELIXIR_APP_SLUG- identifiers your app can log or report.
For .NET apps only, we also set the ASP.NET Core equivalents so a lift-and-shift app runs with no code changes:
ASPNETCORE_URLS- bound to the same port asPORT.ASPNETCORE_HTTP_PORTS- the same port.ASPNETCORE_ENVIRONMENT-Production.
If you provision a managed database or cache inside the same project and link it to your app, we also inject a connection string for it automatically (see Postgres databases / Valkey caches).
Applying changes
Setting or deleting an env var doesn't auto-redeploy. The Environment tab shows a banner reminding you to redeploy - running pods keep their original values until they're rolled over. Hit Deploy on the latest release (or push a new one) to apply changes.
Limits
- Keys: max 200 characters, must match
^[A-Za-z_][A-Za-z0-9_]*$. - Values: max 4000 characters. For larger blobs (certificates, big JSON config), put the blob in object storage and store the URL here.