Environment Variables
Configure application behavior using environment variables on RepoCloud
Using Environment Variables
Environment variables are a powerful way to configure your applications without modifying code. They allow you to customize your application’s behavior, store configuration settings, and manage sensitive information like API keys and database credentials.
What Are Environment Variables?
Environment variables are dynamic values that can affect the way running processes behave on a computer. In the context of containerized applications, they provide a way to:
- Configure application settings
- Store API keys and credentials
- Toggle features on and off
- Set configuration options
- Define connection parameters
Managing Environment Variables on RepoCloud
RepoCloud makes it easy to set, update, and manage environment variables for your applications through a simple web interface.
Accessing Environment Variables
Navigate to Instance Management
Go to your application’s management page in the RepoCloud dashboard
Open Environment Variables
Click on the “Environment Variables” tab
View Current Variables
You’ll see a list of all currently configured environment variables
Adding Environment Variables
Navigate to Environment Variables
Access the Environment Variables section as described above
Add New Variable
Click the “Add Variable” button
Enter Key and Value
Enter the variable name (key) and its value
Example:
- Key:
DATABASE_URL
- Value:
mysql://user:password@localhost:3306/mydatabase
Save Changes
Click “Save” or “Apply Changes” to update your application’s environment
Restart Application
In most cases, your application will automatically restart to apply the new variables
Editing and Deleting Variables
Navigate to Environment Variables
Access the Environment Variables section
Edit a Variable
Click the edit icon next to the variable you want to modify, then update its value
Delete a Variable
Click the delete icon next to the variable you want to remove
Save Changes
Click “Save” or “Apply Changes” to update your application’s environment
Changes to environment variables typically require an application restart to take effect. RepoCloud automatically handles this for most applications.
Sensitive Information and Security
Environment variables are commonly used to store sensitive information like API keys, passwords, and tokens. RepoCloud implements security measures to protect this data:
- Encryption: Environment variable values are encrypted at rest
- Masked Display: Sensitive values are masked in the interface (displayed as
••••••••
) - Access Control: Only authorized users can view and modify environment variables
- No Logging: Sensitive values are not written to application logs
Despite these precautions, you should never store extremely sensitive secrets (like private keys) as environment variables. For such cases, consider using a dedicated secrets management solution.
Common Environment Variables
Different applications use different environment variables, but some common categories include:
Application-Specific Variables
Each application has its own set of supported environment variables. Here are examples for some popular applications:
Check your application’s documentation to understand which environment variables are available and what they do. Many applications include a list of supported variables in their documentation.
Best Practices
Follow these best practices when working with environment variables:
- Use descriptive names: Choose clear, descriptive names for your variables
- Separate development and production: Use different values for development and production environments
- Document your variables: Keep a record of what each variable does and why it’s needed
- Minimize sensitive data: Only store sensitive information in environment variables when necessary
- Use standard formats: Follow established formats for connection strings and other structured data
- Avoid hardcoding: Never hardcode values that should be configurable in your application code