Skip to main content

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

1

Navigate to Instance Management

Go to your application’s management page in the RepoCloud dashboard
2

Open Environment Variables

Click the “Edit Env Vars” button
3

View Current Variables

You’ll see a list of all currently configured environment variables as key/value rows (values are masked)

Adding Environment Variables

1

Navigate to Environment Variables

Access the Edit Env Vars section as described above
2

Add New Variable

Click the ”+ Add New Variable” button
3

Enter Key and Value

Enter the variable name (key) and its value in the new rowExample:
  • Key: DATABASE_URL
  • Value: mysql://user:password@localhost:3306/mydatabase
4

Save Changes

Click “Save Changes” and confirm. Your application will restart with the new variables applied.

Editing and Deleting Variables

1

Navigate to Environment Variables

Access the Edit Env Vars section
2

Edit a Variable

Change the key or value directly in the row you want to modify
3

Delete a Variable

Click the trash icon next to the variable you want to remove
4

Save Changes

Click “Save Changes” and confirm to update your application’s environment
Saving environment variable changes restarts your application so the new configuration takes effect. The restart typically takes 3-7 minutes.

Sensitive Information and Security

Environment variables are commonly used to store sensitive information like API keys, passwords, and tokens. RepoCloud protects this data in the dashboard:
  • Masked Display: Values are masked in the interface (displayed as ••••••••)
  • Access Control: Only your account can view and modify your instances’ environment variables
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:
Variables that define how your application connects to a database:
Variables for third-party service integration:
Variables that control application behavior:
Variables for email service configuration:

Application-Specific Variables

Each application has its own set of supported environment variables. Here are examples for some popular applications:
Common WordPress configuration variables:
Common Node.js application variables:
PostgreSQL configuration variables:
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:
  1. Use descriptive names: Choose clear, descriptive names for your variables
  2. Separate development and production: Use different values for development and production environments
  3. Document your variables: Keep a record of what each variable does and why it’s needed
  4. Minimize sensitive data: Only store sensitive information in environment variables when necessary
  5. Use standard formats: Follow established formats for connection strings and other structured data
  6. Avoid hardcoding: Never hardcode values that should be configurable in your application code

Troubleshooting

If your application doesn’t recognize environment variables:
  • Verify the variable name is correct (including case)
  • Ensure the application has restarted after changes
  • Check application logs for environment-related errors
  • Verify the application is designed to use the variables you’re setting
Some common syntax issues:
  • Avoid spaces around the equals sign (use KEY=value, not KEY = value)
  • Be careful with quotes (some values may need to be quoted)
  • Watch for special characters that might need escaping
If changes don’t seem to apply:
  • Wait for the restart to finish—saving environment variables restarts your app, which takes 3-7 minutes
  • Check if the application caches configuration and needs a specific refresh
  • Verify you clicked “Save Changes” and confirmed in the dashboard
  • As a last resort, use “Rebuild / Update” to recreate the instance with the current configuration

Next Steps

Scaling

Learn how to scale your application resources

Updates

Keep your application updated with the latest features and security patches

Troubleshooting

Resolve common issues with your RepoCloud applications