
Overview
Every application needs configuration — API endpoints, feature flags, database passwords, third-party API keys. Variables & Secrets let you manage all of this without hardcoding values in your code.Variables
Plain text configuration visible in the UI. Use for non-sensitive settings like endpoints, flags, and paths.
Secrets
Encrypted values hidden from view. Use for passwords, API keys, tokens, and anything sensitive.
Variables and Secrets are configured per service and injected as environment variables at runtime — both in dev containers and production deployments.
Why Use Variables & Secrets
Keep secrets out of code
Never commit passwords or API keys to your repository. Store them securely in Ardor.
Environment-specific config
Same code, different configs. Switch between dev/staging/prod without changing code.
Easy updates
Change a value once in the UI — no redeployment needed for dev containers.
Team-friendly
Share configuration without sharing actual secret values. Team members see masked data.
Variables vs Secrets
| Variables | Secrets | |
|---|---|---|
| Visibility | Visible in UI | Masked (••••••••) |
| Storage | Plain text | Encrypted |
| Use for | Endpoints, flags, paths | Passwords, API keys, tokens |
| Editable | View and edit freely | Edit without seeing current value |
Adding Variables & Secrets
1
Open Service Settings
Navigate to your service and open the Variables & Secrets section
2
Add Variable or Secret
Click Add Variable or Add Secret, enter a name and value
3
Save
Changes apply to dev container immediately. For production, redeploy your service.
Naming Conventions
Environment variable names should be:- UPPERCASE with underscores:
DATABASE_URL,API_KEY,DEBUG_MODE - Descriptive:
POSTGRES_PASSWORDnotPW - Prefixed for clarity:
REDIS_HOST,REDIS_PORT,REDIS_PASSWORD
Common Use Cases
- Database Connection
- Third-Party APIs
- Feature Flags
- Service URLs
Connect to PostgreSQL, MySQL, or other databases:
| Variable | Type | Example |
|---|---|---|
DATABASE_HOST | Variable | postgres-service.internal |
DATABASE_PORT | Variable | 5432 |
DATABASE_NAME | Variable | myapp |
DATABASE_USER | Variable | admin |
DATABASE_PASSWORD | Secret | •••••••• |
Reading Variables in Code
Variables and Secrets are injected as environment variables. Here’s how to read them:- Python
- Node.js
- Go
Frontend Services
For frontend services (React, Vue, Next.js, etc.), variables and secrets are composed into a
.env file at build time. Use them in your Dockerfile:- Vite:
VITE_ - Create React App:
REACT_APP_ - Next.js:
NEXT_PUBLIC_
When Changes Apply
| Environment | Variables | Secrets |
|---|---|---|
| Dev Container | Restart container | Restart container |
| Production | Redeploy service | Redeploy service |
Dev containers restart automatically when you save variable changes. For production, you need to trigger a new deployment.
Security
How Secrets Are Protected
- Encrypted at rest — Secrets are stored encrypted in the database
- Masked by default — Shown as
••••••••, but you can reveal them by clicking the eye icon - Secure injection — Passed to containers via secure environment, never logged
- No export — Cannot be exported or downloaded in bulk
Best Practices
Use secrets for anything sensitive
Use secrets for anything sensitive
API keys, passwords, tokens, private keys — if it grants access to something, it’s a secret.
Don't log secrets
Don't log secrets
Be careful with debug logging. Never print environment variables that might contain secrets.
Rotate regularly
Rotate regularly
Change passwords and API keys periodically. Update the secret in Ardor, redeploy, done.
Use descriptive names
Use descriptive names
STRIPE_SECRET_KEY is better than KEY1. Future you will thank present you.Minimum access principle
Minimum access principle
Only add secrets that a service actually needs. Don’t share database passwords with services that don’t use the database.
Troubleshooting
Variable not available in my code
Variable not available in my code
Cause: Container hasn’t restarted after adding the variable.Solution: Restart the dev container or redeploy the service.
Variable has wrong value
Variable has wrong value
Cause: Typo in variable name or old cached value.Solution:
- Check the exact variable name (case-sensitive!)
- Restart container to pick up latest values
Secret visible in logs
Secret visible in logs
Cause: Your code is logging environment variables.Solution: Review your logging code. Never log
os.environ or similar dumps.Frontend can't access variable
Frontend can't access variable
Cause: Missing framework prefix or variable added after build.Solution:
- Add required prefix (
VITE_,REACT_APP_, etc.) - Rebuild and redeploy the frontend
What’s Next
Service Configuration
Learn about all service settings including resources and networking
Development Container
Use the dev container to test your variables in real-time
Connecting Services
Connect multiple services and share configuration
Build with Cerebrum
Let Cerebrum set up variables and secrets for you automatically

