Projecten

Omgevingsvariabelen

Beheer omgevingsvariabelen veilig voor verschillende omgevingen.

3 min leestijd

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

.env.example
# 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=false

Per-Environment Values

Variables can have different values per environment:

VariableDevelopmentPreviewProduction
DATABASE_URLdev-dbpreview-dbprod-db
API_URLlocalhost:3000preview.app.comapi.app.com
DEBUG_MODEtruetruefalse

Accessing Variables

Variables are available at build and runtime:

Example usage
// 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:

  1. Click "Import" in the Environment Variables section
  2. Paste your .env file contents or upload a file
  3. Review and confirm the variables
  4. 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?