Created
March 15, 2020 01:30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$unzipWebStep = "UCSB - Unzip Web Package" | |
$unzipDir = $OctopusParameters["Octopus.Action[$unzipWebStep].Output.Package.InstallationDirectoryPath"] | |
$transformConfigEnv = $OctopusParameters["TransformConfigEnv"] | |
Write-Host @" | |
************************************************************* | |
`$unzipDir = $unzipDir | |
`$transformConfigEnv = $transformConfigEnv | |
************************************************************* | |
"@ | |
$transforms = dir -Path $unzipDir -Filter "appSettings.*.json" | |
if($transforms -eq $null) { | |
Write-Host "No transforms found. Skipping." | |
return | |
} else { | |
Write-Host @" | |
Found $(@($transforms).Count) transforms: | |
$($transforms.Name | Out-String) | |
"@ | |
} | |
## transform the appSettings.json file with the environment specific transform | |
$transformerExe = "D:\AllContent\Scripts\WebApps\Resources\Ucsb.Sa.Enterprise.NetCore.Transforms.Console.exe" | |
$srcJson = "$unzipDir\appSettings.json" | |
$transformJson = "$unzipDir\appSettings.$transformConfigEnv.json" | |
Write-Host @" | |
******************************************************** | |
Transforming ... | |
`$transformerExe = $transformerExe | |
`$srcJson = $srcJson | |
`$transformJson = $transformJson | |
output = $srcJson | |
"@ | |
. $transformerExe --source "$srcJson" --transform "$transformJson" --output "$srcJson" | |
## Remove the appSettings.{env}.json files that don't match the current environment | |
$transforms | Remove-Item -Verbose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment