The write command allows you to write a specified property value to a JSON configuration file. By default, the write command writes values to the file in plain text, but you can encrypt a value by using the --encrypt parameter.
Note the following considerations:
-
If a value already exists for the specified property, the write command overwrites the existing value. This is true regardless of whether the original value is plain text or encrypted.
-
If you are encrypting a value, the configuration file must remain in the location specified in the parameters for the write command. If the file is moved after the value is encrypted, the value cannot be decrypted by the utility or the supported application.
The write command is executed by appending parameters to the Hyland.Application.Settings.Utility.exe write command. The following parameters are available:
Parameter |
Short Name |
Description |
Required |
---|---|---|---|
--applicationRoot |
-a |
The path to the directory that contains the application using the configuration file. For example: -a C:\repo\application |
Yes |
--file |
The file name of the JSON configuration file. If the file is located in a subdirectory of the location specified in the --applicationRoot parameter, also include the relative path to the file. For example: --file config\appsettings.json |
Yes |
|
--property |
-p |
The name of the property to write. For nested properties, use a colon (:) delimiter. For example, where a property called masterDB contains a sub-property called ConnectionString, to which you want to write a value: -p masterDB:ConnectionString |
Yes |
--value |
-v |
The value to write. |
Yes |
--inline |
-i |
Encrypts the value of the provided property in the provided file. |
Yes |
--verbose |
Sets the diagnostics logging level for the information returned by the command. If this parameter is included in a command, detailed logging information is returned. If this parameter is not included in a command, logging information is returned only if an error occurs. |
No |
|
--force |
-f |
Forces the creation of the property if it is not already present in the configuration file. |
No |
--encrypt |
Encrypts the property value written to the configuration file. If this parameter is included in a command, the specified value is encrypted, and the encrypted value is written to the file. If this parameter is not included in a command, the specified value is written to the file in plain text. |
No |
|
--thumbprint |
The certificate thumbprint to use for encrypting data. For example: --thumbprint 00xx00xx00xx00xx00xx00 Note:
Because Linux deployments require certificate-based encryption, this parameter is required for Linux. For Windows deployments, this parameter is only used if you are using certificate-based encryption and a certificate has been registered. See Registering a Certificate. |
Linux: Yes Windows: No |
Required and optional parameters are added to the write command line, as shown in this example:
Hyland.Application.Settings.Utility.exe write -a C:\repo\application --file config\appsettings.json -p masterDB:ConnectionString -v Server=myServer;Database=myDB; --verbose --force --encrypt --thumbprint 00xx00xx00xx00xx00xx00
If a parameter value includes spaces, you must enclose the entire value in quotation marks. For example, if using the -a parameter to point to the path C:\Program Files\App, the full parameter and value would be: -a "C:\Program Files\App"
If the --force parameter is not used, the property passed in must already exist in the file. If the --force parameter is used, then the property passed in does not need to already exist.
If the property exists, --force will write the property value to the configuration file. If the property does not exist, --force will create the configuration sections for the property value and write the value to the configuration file.
If you are using the write command to write a property value in an array, you must use the proper index to refer to an element in the array. See Writing and Reading Array Elements for more information.