Environment Variables
Configuration and secrets for your functions.
Setting Variables
const api = new alien.Function("api")
.environment({
LOG_LEVEL: "info",
API_ENDPOINT: "https://api.example.com",
})
.build()These are available as regular environment variables at runtime.
Secrets
Credentials like API keys and database passwords are stored in the cloud's vault service (SSM, Secret Manager, Key Vault) — never in logs or config files. They're configured per-deployment when onboarding customers, not in alien.ts.
For secrets your app manages at runtime, use a Vault resource.
Per-Deployment Overrides
Different customers often need different values. Override per deployment:
alien deployments set-env --deployment acme-prod LOG_LEVEL=warnBuilt-In Variables
Alien injects automatically:
| Variable | Description |
|---|---|
ALIEN_DEPLOYMENT_TYPE | Platform: aws, gcp, azure |
ALIEN_{NAME}_BINDING | Connection parameters for each linked resource |
The ALIEN_*_BINDING variables are how your code discovers resources. See Accessing Resources.