Managing Environment Variables
Environment variables in Quant Cloud provide a flexible way to configure your applications without hardcoding values into your container images. The platform supports both environment-wide variables that are available to all containers and container-specific variables for more targeted configuration.
Environment variables are managed through the Environment & Secrets tab on your environment details page, where you can define variables that will be automatically injected into all containers within that environment.
Managing Environment Variables
Viewing Current Variables The Environment & Secrets tab displays all currently defined environment variables for your environment, showing both their names and values in a clear, editable interface.
Adding New Variables Click “Add Variable” to create a new environment variable. You’ll need to provide:
-
Name: The environment variable name (e.g.,
API_ENDPOINT
,LOG_LEVEL
,DEBUG_MODE
)- Must be unique within the environment
- Cannot conflict with secret names in the same environment
- Follow standard environment variable naming conventions (uppercase, underscores, alphanumeric)
-
Value: The configuration value that will be available to your containers
Editing Existing Variables You can modify variable values directly in the interface. Variable names are typically immutable once created - to change a variable name, delete the existing variable and create a new one.
Bulk Management
For managing multiple variables efficiently, you can use bulk editing features that allow you to define multiple variables at once using standard KEY=VALUE
format.
Removing Variables Delete variables that are no longer needed using the delete action next to each variable entry.
How Environment Variables Work
Automatic Injection Environment variables defined at the environment level are automatically injected into all containers within that environment. Your applications can access these variables using standard environment variable mechanisms in any programming language.
Variable Precedence When the same variable name is defined in multiple places, the following precedence order applies:
- Container-specific environment variables (highest priority)
- Environment-level variables
- Secrets mapped to environment variables
Environment Inheritance Environment variables are not automatically copied when creating new environments. Each environment maintains its own independent set of variables, allowing you to have different configurations for development, staging, and production environments.
Common Use Cases
Application Configuration
- API endpoints and service URLs
- Feature flags and debug settings
- Cache configuration and timeouts
- External service endpoints
Non-Sensitive Settings
- Log levels and output formats
- Application behavior toggles
- Performance tuning parameters
- UI customization settings
Best Practices
Naming Conventions Use clear, descriptive names that follow standard environment variable conventions:
- Use UPPERCASE with underscores (e.g.,
API_BASE_URL
,MAX_RETRY_COUNT
) - Group related variables with prefixes (e.g.,
REDIS_HOST
,REDIS_PORT
,REDIS_TIMEOUT
) - Avoid spaces and special characters
Value Management
- Use meaningful default values when possible
- Document the purpose and expected format of each variable
- Keep values environment-appropriate (development vs. production URLs)
Security Considerations
- Environment variables are visible in container logs and process lists
- Values are stored in plain text and visible in the management interface
- Team members with environment access can view all variable values
- Use secrets for any sensitive information instead of environment variables
Environment variables provide a flexible foundation for application configuration while maintaining clear separation between environments and ensuring your applications remain configurable without code changes.