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.

CloudStation Service Variables

Shared Variables

Shared variables help reduce duplication of variables across multiple services within the same project.

CloudStation Service Variables

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 in your service, follow these steps:

  1. Navigate to the "Variables -> Shared Variables" tab of your service.
  2. Click on " + New Variable".
  3. In the "Key" field, enter the name of the shared variable you want to use.
  4. In the "Value" field, use the syntax ${SHARED_VARIABLE_NAME} to reference the shared variable.
  5. Click Add to apply the changes.

This allows your service to dynamically reference the shared variable's value, ensuring consistency across your project.

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).

CloudStation Service Discovery


Edit this file on GitHub