Submission

Hi,

I’ve written a powershell script which will perform a similar action to that included for .config files but for .json files - in that it’ll replace any variables in the file with the Octopus held version. I thought it’d be something that’d be worth making general and including for you - it’d be absolutely brilliant if it could be an option on a site for instance. It does require Powershell 3 though.

Hope someone finds it useful.

Cheers

Stu

$filename = $OctopusParameters[‘Octopus.Action[Deploy Web Site].Output.Package.InstallationDirectoryPath’] + “/config.json”
$json = (Get-Content $filename -Raw) | ConvertFrom-Json

foreach($variable in $OctopusParameters.GetEnumerator())
{
$key = $variable.Key
if ($json.$key)
{
$json.$key = $variable.Value
}
}
$json |ConvertTo-Json | Out-File $filename

Hi Stuart,

Thanks for reaching out. This already exists in Octopus since 2.3 :slight_smile:

Cheers,

Dalmiro