(Environment) Variables ​
This section provides information about environment variables and how they can be used across different Rulecube environments. Rulecube has these environments:
- test
This is the development environment where you create and maintain rulesets. - demo
This is the quality assurance environment where testers and users test rulesets. - app
This is the live environment where users work with rulesets.
And this is the correlated development process you usually follow for your rulesets:
- You create and maintain your rulesets in the test environment.
- When ready, you export your ruleset and import it into the demo environment.
- The persons responsible for quality assurance test the ruleset in the demo environment.
- You correct the issues they find in test and deploy them to demo until you solved all issues, and the ruleset is ready to go live.
- You export your ruleset and import it into the app environment where users work with it.
A variable with a different value for each environment ​
Now, let's assume that a ruleset calls an external API for financial data, and the corresponding URL varies per environment:
| Environment | API URL |
|---|---|
| test | dev.findata.com |
| demo | test.findata.com |
| app | api.findata.com |
One solution to this is to create a constant for the URL and change the constant value each time you deploy your ruleset to a different environment. But this is cumbersome and error-prone. So it's much better to use an environment variable because you only have to set the environment-specific values for the same variable once. And when you deploy your ruleset, Rulecube automatically chooses the correct variable value for the environment it's running in.
For example, you create an environment variable named FinDataURL and assign it the appropriate values in each environment:
| Environment | FinDataURL |
|---|---|
| test | https://dev.findata.com |
| demo | https://test.findata.com |
| app | https://api.findata.com |
Now, when you run in test, Rulecube automatically picks the dev.findata.com URL, and when you run in app, Rulecube selects the api.findata.com URL. Fully automated, without any intervention from your side.
Related How-to Guides ​
Use the following guides to complete tasks related to environment variables: