Configs & Secrets

Overview

Kloudlite provides two ways to manage configuration and sensitive data for your services: Environment Variables for key-value configuration and Config Files for complex configuration files. Secrets are stored securely and encrypted at rest.

Environment Variables

Key-value pairs for simple configuration (API keys, database URLs, feature flags)

Config Files

Full configuration files that services can mount and use (JSON, YAML, etc.)

Environment Variables

Environment variables are key-value pairs that are injected into your services at runtime. They're perfect for configuration that changes between environments.

Common Use Cases:

  • Database Connection Strings: DATABASE_URL=postgres://user:pass@postgres:5432/myapp
  • API Keys & Tokens: STRIPE_API_KEY=sk_test_...
  • Feature Flags: ENABLE_BETA_FEATURES=true
  • Environment Names: NODE_ENV=development

Configuration Files

Config files allow you to upload complete configuration files that can be mounted into your services. This is useful for complex configurations that don't fit well as environment variables.

Supported File Types:

  • JSON/YAML Configs: Application configuration files
  • Nginx/Apache Configs: Web server configuration
  • SSL Certificates: TLS certificates and keys
  • Any Text File: Custom configuration formats

Secrets Management

Secrets are sensitive data like passwords, API keys, and tokens. They are stored encrypted at rest and only decrypted when injected into services.

Security Best Practices

  • Never commit secrets to version control
  • Use environment-specific secrets for different stages
  • Rotate secrets regularly
  • Limit secret access to only services that need them

Secret Features:

  • Encrypted Storage: All secrets encrypted at rest
  • Secure Injection: Secrets only visible to authorized services
  • Version History: Track changes to secret values

Using in Services

Reference configs and secrets in your Docker Compose service definitions using environment variable substitution.

Example: Using Environment Variables in Services

services:
  api:
    image: myapp/api:latest
    environment:
      # Reference environment-level variables
      DATABASE_URL: ${DATABASE_URL}
      REDIS_URL: ${REDIS_URL}
      API_SECRET: ${API_SECRET}
      NODE_ENV: production
    ports:
      - "3000:3000"

Environment-Level Configuration

All configs and secrets are defined at the environment level in the Environment Settings. They are then available to all services in that environment via variable substitution.