Change Environment Settings

◷ Reading Time: 5 minutes

When a group of people collaboratively work on a project, they may want to :

  • Build and test automation models
  • Maintain and collaborate on the projects artifacts
  • Build a Decision Package for specific scenario
  • Deploy the package to a specific environment

In order to navigate to these different environments (QA, Staging, Production etc…) you can create different environment profiles and set parameters to each environment. Then you can select which environment to be used.

How to setup different environment profiles in FlexRule Designer

When you click on the project name in Project Explorer window, the Properties window will be as follows.

Properties window for environment

Define Environment Profiles

In here you need to create a set of environment profiles under the Settings.

settings for environment

Environment Config: You need to have a Business Formulas document in your project which will specify relevant environment settings (database connection strings, logging details, parameters etc..) for this environment profile. This box allows you to select that document or you can give a relative address.

Environment Name: Name of the environment profile setting.

Create Environment Settings document

Create a separate Business Formulas file to store environment settings for each Environment Profile.

These settings should be a literal type of expression and type should be Text.

Business Formula document

Define the Binding Parameter

Once you setup Environment Profiles, you need to define a local parameter (binding parameter) to access those environment settings. This parameter can be defined in any logic document where you want to access the environment settings.

binding parameter

Once you define all of these settings, you can choose which Environment Profile needs to be selected from the drop down menu in the properties window.

Check the sample project and its explanation here for more detail.

Change Environment using FlexRule CLI Update

When you deploy your model as a service end point (Ex: AZURE), you can change already defined environment profiles using FlexRule CLI update command. Please click here for more details.

Sample Model with multiple Environment Profiles

In this example, we have a logic document (GenericFlow.xml) which queries data from a database. When we select different Environment Profiles, the database node should refer to the relevant database according to the environment settings.

We have defined three different Environment Profiles for a generic flow execution with a database node.

Those three different Environment Profiles refer to three Business Formulas documents.

The following image shows different databases for specific Environment.

database for environment settings

The following image shows three different Business Formula files for each Environment Profile. Each has a “ConnectionString” as a literal expression which refers to three separate databases.

Business formula, three document types

Then we have created the three separate Environment Profiles as follows.

different environment profile settings

The binding parameter (Connection) is defined in the logic document as a local parameter.

binding parameter

The database node in the GenericFlow logic document uses the binding parameter (Connection) to access the Connection String value of the relevant environment setting.

Connection String for Environment setting

The database query result is the list of Cars according to the selected Environment Profile.

When you select different Environment Profiles and run the module, the output (Cars) will be changed as follows.

Production Environment Profile

Production Environment Results

QA Environment Profile

QA Environment Results

Staging Environment Profile

Staging Environment Results

Download the Sample Project

You can download the sample project along with three database scripts which related to this example.

To set up databases, you need to make sure you run those three scripts in your database server and in the project, update the “ConnectionString” value in each Business Formulas document with the relevant database server name and credentials.

Updated on December 8, 2023

Article Attachments

Was this article helpful?

Related Articles