Omgevingsvariabelen
Beheer omgevingsvariabelen veilig voor verschillende omgevingen.
Environment variables let you configure your application differently across environments without changing code. TurtleApps provides secure storage and management for all your env vars.
Understanding Environments
TurtleApps supports three environments:
- Development — Used during AI development
- Preview — Used in preview deployments
- Production — Used in production deployments
Adding Variables
Navigate to Project Settings → Environment Variables.
Environment variables interface
[Screenshot placeholder]
Variable Types
- Plain Text — Visible to project admins
- Secret — Encrypted, only shown once when created
- Reference — References another variable
⚠️Secret Variables
Secret variables cannot be viewed after creation. If you need to update a secret, you must delete and recreate it.
Common Variables
# Database
DATABASE_URL=postgresql://user:pass@host:5432/db
# Authentication
NEXTAUTH_SECRET=your-secret-key
NEXTAUTH_URL=https://your-domain.com
# External APIs
STRIPE_SECRET_KEY=sk_live_...
OPENAI_API_KEY=sk-...
# Feature Flags
ENABLE_ANALYTICS=true
DEBUG_MODE=falsePer-Environment Values
Variables can have different values per environment:
| Variable | Development | Preview | Production |
|---|---|---|---|
| DATABASE_URL | dev-db | preview-db | prod-db |
| API_URL | localhost:3000 | preview.app.com | api.app.com |
| DEBUG_MODE | true | true | false |
Accessing Variables
Variables are available at build and runtime:
// Server-side (Node.js)
const dbUrl = process.env.DATABASE_URL;
// Client-side (Next.js)
// Prefix with NEXT_PUBLIC_ for client exposure
const apiUrl = process.env.NEXT_PUBLIC_API_URL;✨Client-Side Variables
Only variables prefixed with NEXT_PUBLIC_ (or your framework's equivalent) are exposed to the browser. Never put secrets in client-accessible variables.
Importing Variables
Bulk import from a .env file:
- Click "Import" in the Environment Variables section
- Paste your .env file contents or upload a file
- Review and confirm the variables
- Choose which environments to apply them to
Best Practices
- Never commit .env files to Git
- Use secrets for sensitive values
- Document required variables in .env.example
- Rotate secrets regularly
- Use different values for each environment
Was dit artikel nuttig?