in src/Saas.Identity/Saas.IdentityProvider/deployment/script/generate-ief-policies.py [0:0]
def policy_builder(policy_dir: str, app_settings_file: str) -> None:
with open(app_settings_file, 'r') as f:
app_str= f.read()
appsettingsDict = json.loads(app_str)
# For each environment in the appsettings file create separate folder with the policy files
for env in appsettingsDict['Environments']:
tenantId = env['Tenant']
environment = env['Name']
output_dir = os.path.join(policy_dir, f"Environments/{environment}")
# Copy the policy files to the output directory
copy_policy_files(policy_dir, output_dir)
# Patch the policy files with the tenantId
patch_policy_file(output_dir, "Tenant", tenantId)
# Patch the policy files with each of the policies settings
for policyName in env['PolicySettings']:
val = env['PolicySettings'][policyName]
patch_policy_file (output_dir, policyName, val)