Environment Variables
Learn how to configure your applications with environment variables on sota.io.
Overview
Environment variables are the primary way to configure your application's runtime behavior. sota.io encrypts all environment variables at rest using AES-256-GCM.
Setting Variables
Via CLI
sota env set DATABASE_URL=postgres://user:pass@host:5432/db
sota env set STRIPE_KEY=sk_live_...
sota env set NODE_ENV=production
Via API
curl -X POST https://api.sota.io/v1/projects/550e8400-.../envs \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"key": "DATABASE_URL", "value": "postgres://..."}'
Reading Variables
Via CLI
# Get a specific variable
sota env get DATABASE_URL
# List all variables
sota env list
In Your Application
Environment variables are injected into the container and available via standard methods:
// Node.js
const dbUrl = process.env.DATABASE_URL;
# Python
import os
db_url = os.environ.get("DATABASE_URL")
// Go
dbUrl := os.Getenv("DATABASE_URL")
Auto-Injected Variables
These variables are always available without manual configuration:
| Variable | Value | Description |
|---|---|---|
PORT | 8080 | Your app must listen on this port |
DATABASE_URL | Connection string | Only when managed PostgreSQL is provisioned |
Build-Time vs Runtime
Environment variables are injected at runtime (when the container starts), not at build time.
For frameworks that need build-time variables (like Next.js NEXT_PUBLIC_*), set the variables before deploying:
sota env set NEXT_PUBLIC_API_URL=https://api.example.com
sota deploy
Encryption
All values are encrypted using AES-256-GCM before storage. The encryption key is managed by the platform. Values are decrypted only when injected into the container.
Redeployment
Changing environment variables does not trigger an automatic redeployment. Run sota deploy to apply new variable values.