logo
logo

Environment profiles

When dealing with multiple environments, some values (like authentication configuration) need to be set depending on the target environment. For this purpose environment profiles were introduced.

It is a simple "search and replace" functionality, that when provided with an EnvironmentProfile.json file, scans the package content in search of a replace template and replaces it with the value from the profile.

The template is in the form of ##{key}## where key is dependent on the content of the profile.
The EnvironmentProfile.json file needs to be located in the package root (alongside the meta file).

Sample profile content:

{
    "key1": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress",
    "key2": {
        "Key": "aKey",
        "Secret": "secret"
    },
    "key3": 5,
    "key4": true
}

Sample resource file:

{
  "version": "1.0.0",
  "data": {
    ...
    "properties": {
      "M.Setting.Name": "Authentication",
      "M.Setting.Value": {
        "UsernameClaimType": ##key1##,
        "EmailClaimType": ##key1##,
        "ReCaptcha": ##key2##,
        "MinutesToLockout": ##key3##,
        "EnableRegister": ##key4##,
        ...
      },
      ...
    },
    ...
}

After running the import, placeholders will be replaced with their corresponding values.

Can we improve this article ? Provide feedback