Create an environment variable ​
Procedure ​
Let's bring the example into practice:
Step 1: Create the environment variable in test and use it in the ruleset ​
If you're not in your Rulecube test environment, move over to test.
Create a ruleset named
EnvExample.Click Variables from the top menu.
↳ The general Environment variables page opens.Click Add variable.
↳ Rulecube adds a new environment variable row.In the Name field, enter
FinDataURL.In the Value field, enter
https://dev.findata.com.Click Save.
Now, open the ruleset where you want to use the environment variable.
Click Environment variables from the menu at the left.
↳ The ruleset Environment variables page opens:\
Select the FinDataURL checkbox.
Create a rule named
ShowURLand set its Expression to:javascriptFinDataURL↳ This rule just returns the content of the environment variable, which is fine for illustrating how environment variables work, but in practice, a rule Expression like this is more realistic:
javascriptHttp.request(FinDataURL + "?region=europe").data.dataClick Save.
Click Try it out.
Click Execute.
↳ The Sandbox output shows"https://dev.findata.com".
Step 2: Create the environment variable in demo ​
- Move over to your demo environment.
- Click Variables from the top menu.
- Click Add variable.
- In the Name field, enter
FinDataURL. - In the Value field, enter
https://test.findata.com. - Click Save.
Step 3: Create the environment variable in app ​
- Move over to your app environment.
- Click Variables from the top menu.
- Click Add variable.
- In the Name field, enter
FinDataURL. - In the Value field, enter
https://api.findata.com. - Click Save.
Step 4: Deploy your ruleset ​
- Move back to your test environment.
- Open the
EnvExampleruleset. - Click Export.
↳ The Export pop-up opens. - Click OK.
↳ Rulecube exports the ruleset as a JSON file into the default download folder on your workstation. - Move over to your demo environment.
- Click Import.
↳ The Import ruleset pop-up opens. - Open your file manager and navigate to your default download folder.
- Drag the exported ruleset JSON file and drop it on the Upload (or drag) ruleset data file section of the Import ruleset pop-up.
- Click Upload.
↳ Rulecube imports the ruleset and shows the General settings page for the ruleset. - Click Try it out.
- Click Execute.
↳ The Sandbox output now shows"https://test.findata.com"as the value of theFinDataURLenvironment variable.
And you can do the same deployment steps for your app environment.