Skip to main content

Variable Sets

Variable Sets allow you to organize and manage environment variables that can be shared across multiple applications. This simplifies configuration management and ensures consistency.

What are Variable Sets?

A Variable Set is a collection of key-value pairs (environment variables) that you can attach to one or more applications. Instead of defining the same variables for each application, you create a reusable set.

Benefits

Reusability

Define variables once, use in multiple applications:

Database Variable Set → Used by: API, Worker, Admin Panel

Consistency

Ensure all applications use the same configuration values.

Easy Updates

Update a variable in one place, affects all applications using that set.

Organization

Group related variables together logically.

Creating Variable Sets

Step 1: Navigate to Variable Sets

  1. Go to Attachments > Variable Sets
  2. Click "Create Variable Set"

Step 2: Name and Description

Name: database-config
Description: Database connection settings for production

Step 3: Add Variables

Add key-value pairs:

DATABASE_HOST=postgres.example.com
DATABASE_PORT=5432
DATABASE_NAME=myapp_prod
DATABASE_USER=app_user
DATABASE_SSL=true

Step 4: Save Variable Set

Click "Create Variable Set" to save.

Using Variable Sets

Attach to Application

During application creation or editing:

  1. Navigate to "Environment Variables" section
  2. Click "Attach Variable Set"
  3. Select one or more variable sets
  4. Variables are automatically added to the application

Multiple Variable Sets

Attach multiple sets to one application:

Application: user-api

Attached Variable Sets:
- database-config (DATABASE_*)
- cache-config (REDIS_*)
- api-keys (API_KEY, SECRET_KEY)

Variable Precedence

When variables conflict:

  1. Application-specific variables (highest priority)
  2. Last attached variable set
  3. First attached variable set
tip

Place more specific variable sets last to override general ones.

Common Variable Sets

Database Configuration

# Variable Set: database-production
DATABASE_HOST=postgres-prod.example.com
DATABASE_PORT=5432
DATABASE_NAME=app_production
DATABASE_USER=app_user
DATABASE_PASSWORD=********
DATABASE_SSL=true
DATABASE_POOL_SIZE=20

API Configuration

# Variable Set: api-config
API_URL=https://api.example.com
API_VERSION=v1
API_TIMEOUT=30000
API_RETRY_ATTEMPTS=3

Authentication

# Variable Set: auth-secrets
JWT_SECRET=********
JWT_EXPIRATION=3600
OAUTH_CLIENT_ID=********
OAUTH_CLIENT_SECRET=********
SESSION_SECRET=********

Feature Flags

# Variable Set: feature-flags
FEATURE_NEW_DASHBOARD=true
FEATURE_BETA_API=false
FEATURE_ANALYTICS=true

External Services

# Variable Set: third-party-services
STRIPE_API_KEY=********
SENDGRID_API_KEY=********
AWS_ACCESS_KEY=********
AWS_SECRET_KEY=********
S3_BUCKET=uploads-production

Managing Variable Sets

Viewing Variable Sets

Click on a variable set to see:

  • All variables and values
  • Applications using this set
  • Last modified date
  • Created by

Editing Variable Sets

  1. Navigate to variable set details
  2. Click "Edit"
  3. Add, modify, or remove variables
  4. Save changes
caution

Changes will restart or rollout all applications using this variable set.

Versioning

Thevenin tracks variable set versions:

  • View change history
  • See who made changes
  • Restore previous versions
  • Compare versions

Deleting Variable Sets

  1. Ensure no applications are using the set
  2. Navigate to variable set details
  3. Click "Delete Variable Set"
  4. Confirm deletion

Environment-Specific Sets

Create different sets for different environments:

database-development:
DATABASE_HOST=localhost
DATABASE_NAME=app_dev

database-staging:
DATABASE_HOST=db-staging.example.com
DATABASE_NAME=app_staging

database-production:
DATABASE_HOST=db-prod.example.com
DATABASE_NAME=app_production

Best Practices

Naming Conventions

Use clear, descriptive names:

  • database-production
  • api-keys-staging
  • feature-flags-global
  • vars1, config

Variable Naming

Follow standard conventions:

✅ DATABASE_HOST
✅ API_KEY
✅ FEATURE_FLAG_NAME

❌ databaseHost (use uppercase)
❌ api-key (use underscores)

Secrets Management

  • Mark sensitive values as secrets
  • Rotate secrets regularly
  • Never commit secrets to version control
  • Use different secrets for each environment
  • Document what each secret is for

Organization

Group related variables:

database-config: DATABASE_*
cache-config: REDIS_*, MEMCACHED_*
auth-config: JWT_*, OAUTH_*
external-services: STRIPE_*, AWS_*, SENDGRID_*

Documentation

Document each variable set:

Name: database-production
Description: Production database connection settings
Variables:
DATABASE_HOST: PostgreSQL server hostname
DATABASE_PORT: PostgreSQL server port (default 5432)
DATABASE_NAME: Database name
DATABASE_USER: Application database user
DATABASE_PASSWORD: Database user password (secret)

Security Considerations

Encryption

Thevenin encrypts variables:

  • Encrypted at rest in database using age keys
  • Masked in user interface
  • Not exposed in logs
  • Secure transmission with TLS

Audit Logging

Track variable set changes in the variableset history:

  • Who made changes
  • What was changed
  • When changes occurred
  • Previous values

Troubleshooting

Variables Not Applied

Problem: Application doesn't see variables

Solutions:

  • Verify variable set is attached to application
  • Redeploy application after attaching
  • Check variable names (case-sensitive)
  • Review variable precedence

Wrong Variable Value

Problem: Variable has unexpected value

Solutions:

  • Check for conflicting variables in multiple sets
  • Verify variable set order (precedence)
  • Review recent changes to variable sets

Examples

Complete Application Setup

Application: user-service-api

Variable Sets:
1. environment-production
- ENVIRONMENT=production
- LOG_LEVEL=info
- NODE_ENV=production

2. database-production
- DATABASE_HOST=postgres-prod
- DATABASE_PORT=5432
- DATABASE_NAME=users
- DATABASE_USER=api_user
- DATABASE_PASSWORD=********

3. auth-secrets
- JWT_SECRET=********
- JWT_EXPIRATION=3600

4. feature-flags
- FEATURE_2FA=true
- FEATURE_OAUTH=true

Application-Specific Variables:
- SERVICE_NAME=user-service
- PORT=3000

Next Steps