judedaryl / ieftool

MIT License
12 stars 7 forks source link

build command #8

Closed judedaryl closed 9 months ago

judedaryl commented 9 months ago

Added a build functionality that takes in IEF policies and interpolates them with variables provided by a configuration file or through an environment variable.


Usage: ieftool build [options]

Compiles B2C templates and policies

Options: -c, --config Specify the path to the b2c compiler configuration (default: "./b2c-template.json") -p, --source_path Specify the path to the templates folder (default: "./src") -o, --output_dir Specify the output folder (default: "./build") -h, --help display help for command


Variables

The variables are provided by the configuration file in the format below. But can also be provided through environment variables IEF_someVariableKey.

Any variable that is used by ieftool must be prefixed with "IEF", for example IEF_someVariableKey

{
    "parameters": {
        "tenant": "mytenant",
        "insightsInstrumentationKey": "00000000-0000-0000-0000-000000000000",
        "templateUrl": "https://contoso.com"
    }
}

These variables can then be used in your policies through a double bracket syntax.

For example:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TrustFrameworkPolicy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  TenantId="{{tenantId}}" PolicyId={{someVariableKey}}
/>
...
</TrustFrameworkPolicy>