Environment Variables
How to configure and manage environment variables for your sites in Sproobo
Environment variables are key-value pairs that configure your application at runtime. Sproobo injects them into your app before startup on every deployment.
What are Environment Variables?
Environment variables let you:
- Configure your app without changing code
- Keep secrets like API keys and passwords out of your repository
- Use different values for different sites or environments
Common Use Cases
- Database connection strings
- API keys and tokens
- Feature flags
- Service URLs
- Environment name (production, staging, etc.)
Adding Environment Variables
- 1
Open Site Settings
In the dashboard, navigate to your site and open the "Environment" or "Settings" tab.Navigate to Environment Variables in your site settings. - 2
Add a Variable
Click "Add variable" and enter:- Key: Variable name (e.g.
DATABASE_URL) - Value: The value for this variable
Add a new environment variable with key and value. - Key: Variable name (e.g.
- 3
Save and Redeploy
Save your changes. Environment variable updates take effect on the next deployment — trigger a redeploy to apply them immediately.ℹ️Changes to environment variables require a redeploy to take effect.
Bulk Import via .env File
You can import multiple variables at once by pasting or uploading a .env file:
env
DATABASE_URL=postgresql://user:pass@host:5432/dbname
API_KEY=your-api-key-here
SECRET_KEY=your-secret-key-here
Security
How Sproobo Protects Your Secrets
- Environment variable values are encrypted at rest using AES-256-GCM
- Values are never written to deployment logs
- Variables are only decrypted in memory when injected into your app
Troubleshooting
Common Issues
- Variable not available: Trigger a redeploy after adding variables — they are not injected into a running process automatically
- Wrong value: Check for typos in the variable name
- Encoding issues: Ensure special characters in values are properly handled (quote the value if needed in your .env file)
Best Practices
Best Practices
- Use descriptive, uppercase names (e.g.
DATABASE_URL, notdb) - Never commit secrets to version control
- Rotate credentials regularly and update the variable when you do
- Document what each variable does in your project README