Docs / Apps
Environment variables
3 minute read
Keep secrets and settings out of your code. Variables are encrypted at rest and given to your app at build time and when it runs.
1. Add a variable
Open the app, go to Settings → Environment variables and click Add variable. Mark secrets as hidden so the value is masked in the console and logs.
Changes apply on the next deploy. Click Save and redeploy to apply them now.
PORT is set for you. Don't override it.2. Manage them from code
simplicloud apps env set storefront NODE_ENV=productionsimplicloud apps env set storefront PAYSTACK_SECRET_KEY=sk_live_… --secretsimplicloud apps env list storefrontsimplicloud apps env unset storefront OLD_FLAG
3. Import a .env file
Moving an existing app? Import every line of a .env file at once. Existing keys are overwritten.
Terminal
simplicloud apps env import storefront .env✓ 7 variables set · redeploy to apply
Keep
.env in .gitignore. Anything committed to the repository can be read by everyone with access to it.4. Connect a database
When you attach a managed database to an app, DATABASE_URL is added for you, pointing at the database over the private network:
postgres://orders:••••@orders-db.production.internal:5432/orders?sslmode=require
Was this page helpful?