โShow me how to set environment variables and secrets in Render's dashboard for my Dockerized service, and how the app reads them.โ
13 โ [Optional] Configure env vars on Render
Category: Hosting & Deploy ยท Priority: Low ยท Optional
Never commit
.envto git. Add all required env vars directly in Render's Environment section.
โ ๏ธ OPTIONAL โ Only needed if deploying to Render.
๐ฏ What is this task?
Your app reads config from environment variables (like PORT and NODE_ENV). On your computer these come from .env. On Render, you set them directly in their dashboard โ never by uploading your .env file.
๐ Step-by-step
Step 1 โ Go to your Render service dashboard
Click on your Web Service โ click the "Environment" tab in the left sidebar.
Step 2 โ Add each variable
Click "Add Environment Variable" for each one:
| Key | Value |
|---|---|
PORT | 3000 |
NODE_ENV | production |
If you added Postgres later, also add DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD.
Step 3 โ Save and redeploy
After adding all variables, click "Save Changes". Render will automatically trigger a new deployment.
โ Done when
- All environment variables are set in the Render dashboard
- No
.envfile was ever committed to GitHub - Render redeploys successfully after saving env vars
๐ Quiz
Answer all 1 questions correctly to complete this lesson.