Using Variables
Efficiently control your application's behavior across various stages with environment variables
In CloudStation, service variables play a pivotal role by being available during build, deployment, and runtime processes. These variables are accessible to your application as environment variables.
You'll find service variables in the following contexts:
- Service deployment's build process
- Active service deployment
- Invoked command instances
Variables
When you deploy a project for the first time, you can define variables within the deployment form under the "Environment Variables" section. Simply add your desired Keys and Values there.
To manage variables, navigate to the "Variables" tab in CloudStation's project view panel. You can tailor variables for each environment specific to the project or service.
Shared Variables
Shared variables help reduce duplication of variables across multiple services within the same project.
Define a Shared Variable
From your Service -> Shared Variables tab, New variable, enter the variable name and value, and click Add
.
Use a Shared Variable
To use a shared variable, either click the Share button from the Project Settings -> Shared Variables menu and select the services with which to share, or visit the Variables tab within the service itself and click "Shared Variable".
Adding a shared variables to a service creates a Reference Variable in the service.
Service Discovery
Variables scoped to individual services can be defined by navigating to a service's "Variables" tab.
Adding new service discovery variables
Form services
- From the list of available services, choose the relevant service for which you want to add an ENV.
Choose the Service Port
- Choose the appropriate port associated with the selected service.
Enter the Key and Value
- In the "Key" field, enter the name of the environment variable you want to create (e.g., DB_USER, REDIS_URL).
- In the "Value" field, provide the value corresponding to the key (e.g., admin, localhost:6379).
Edit this file on GitHub