From d388c7757010156bd79d4c2fb3cc812c91a4683d Mon Sep 17 00:00:00 2001 From: vnugent Date: Sat, 17 Aug 2024 22:00:42 -0400 Subject: package and configuration update for upstream updates --- ci/compile.ps1 | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'ci/compile.ps1') diff --git a/ci/compile.ps1 b/ci/compile.ps1 index 2858d06..459f304 100644 --- a/ci/compile.ps1 +++ b/ci/compile.ps1 @@ -5,15 +5,19 @@ $templateFiles = Get-ChildItem -Path $inputDir -Filter "*-template.json" -File foreach ($file in $templateFiles) { $baseFilename = $file.BaseName + '.json' $templateFilePath = $file.FullName - - #remove the -template.json suffix - $outputFilePath = Join-Path -Path $outputDir -ChildPath $baseFilename.replace("-template","") - #substitute environment variables for file variables - Get-Content $templateFilePath | ForEach-Object { - if ($_ -match "\$\{((\w+))\}") + #remove the -template.json suffix + $outputFilePath = Join-Path -Path $outputDir -ChildPath $baseFilename.replace("-template","") + + #substitute environment variables for file variables + Get-Content $templateFilePath | ForEach-Object { + if ($_ -match "\$\{(\w+)(:-([^\}]+))?\}") { - $_ -replace "\$\{(\w+)\}",$([Environment]::GetEnvironmentVariable($Matches[1])) + $varName = $Matches[1] + $defaultValue = if ($Matches[3]) { $Matches[3] } else { '' } + $envValue = [Environment]::GetEnvironmentVariable($varName) + if (!$envValue) { $envValue = $defaultValue } + $_ -replace "\$\{(\w+)(:-([^\}]+))?\}", $envValue } else { -- cgit