This tool is useful for performing configuration transformations on multiple file types including JSON, XML, YAML and flat configuration files (like .env files).
Usage
There are three parameters that need to be set:
TargetFile
- The directory to write the transformed files to
FileType
- The type of file to transform. Currently supported are json
, xml
, yaml
and flat
Transformations
- A list of transformations to perform. Transformations are defined as a JSON object, referencing keys and values to be
replaced in the target file. The key indicates the JSON path to the desired key in the target file, the value is the value to be set.
For the following target file:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"System": "Information",
"Microsoft": "Information"
}
},
"ConnectionStrings": {
"Default": "Server=localhost;Port=5432;Database=myapp_local;User Id=admin;Password=admin;"
},
"AdminPassword": ""
}
Logging:
LogLevel:
Default: Information
System: Information
Microsoft: Information
ConnectionStrings:
Default: Server=localhost;Port=5432;Database=myapp_local;User Id=admin;Password=admin;
AdminPassword: ""
The following transformation:
{
"Logging.LogLevel.Default": "Error",
"ConnectionStrings.Default": "Server=postgresql.database;Port=5432;Database=MyApp;User Id=admin;Password=SecretPa$$word;",
"AdminPassword": "SuperSecretPa$$word"
}
The result in the target file will be:
{
"Logging": {
"LogLevel": {
"Default": "Error",
"System": "Information",
"Microsoft": "Information"
}
},
"ConnectionStrings": {
"Default": "Server=postgresql.database;Port=5432;Database=MyApp;User Id=admin;Password=SecretPa$$word;"
},
"AdminPassword": "SuperSecretPa$$word"
}
Logging:
LogLevel:
Default: Error
System: Information
Microsoft: Information
ConnectionStrings:
Default: Server=postgresql.database;Port=5432;Database=MyApp;User Id=admin;Password=SecretPa$$word;
AdminPassword: SuperSecretPa$$word