Skip to content

Commit

Permalink
Merge branch 'BLAIS5-4406' of github.com:ONSdigital/blaise-azure-pipe…
Browse files Browse the repository at this point in the history
…lines into BLAIS5-4406
  • Loading branch information
kristian4res committed Oct 1, 2024
2 parents 8e4c7a2 + 242f9dd commit a236acf
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scripts/update_system_environment_variables.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,19 @@ function UpdateEnvironmentalVariable {
# This is for environments that have been previously set up, so the secret values should remain the same
Write-Host "Environmental Variable is set to a different value than Secret, Creating new secret version"

$tempFile = New-TemporaryFile
Set-Content -Path $tempFile -Value $envValue -NoNewline -Encoding utf8NoBOM
$tempFile = New-TemporaryFile

# Create a UTF8 encoding without BOM
$utf8NoBomEncoding = New-Object System.Text.UTF8Encoding($false)

# Write the content to the file using the specified encoding
[System.IO.File]::WriteAllText($tempFile, $envValue, $utf8NoBomEncoding)


# Add the secret using gcloud
& gcloud secrets versions add $secret --data-file=$tempFile

# Clean up the temporary file
Remove-Item $tempFile
}
elseif ($envValue -ne "" -and $null -ne $envValue) {
Expand Down

0 comments on commit a236acf

Please sign in to comment.