postprovision.ps1 breaks when values contains '=', such as an AppInsights connection string containing (IngestionEndpoint= and LiveEndpoint=)
A solution could be something like this perhaps? foreach ($line in $lines) { $index = $line.IndexOf('=') $name = $line.Substring(0, $index) $value = $line.Substring($index + 1) $value = $value.Replace('"', '') $name = $name.Replace('__', '') if ($value -ne '') { dotnet user-secrets set $name $value | Out-Null } }
curious, were you planning on submitting a pull request inclusive of application insights?
yeah, that was my idea
cc @jongio on what he'd suggest as the safest way to terminate strings like that on the incoming. thanks for the contribution idea, let's get it in there. any chance you could optimize for making the app produce a nice app map, too?
the app insights, I can make a pr on that, but don't have access to the preview 3 packages, should I request to merge into '02-end'?
@pascostefan - Can you test this?
function Set-DotnetUserSecrets {
param ($path, $lines)
Push-Location
cd $path
dotnet user-secrets init
dotnet user-secrets clear
foreach ($line in $lines) {
# Split the line at the first equal sign only
$parts = $line -split '=', 2
$name = $parts[0]
$value = $parts[1]
# Remove quotes from the value
$value = $value -replace '"', ''
# Replace double underscores with colon in the name
$name = $name -replace '__', ':'
# Set the secret if the value is not empty
if ($value -ne '') {
dotnet user-secrets set $name $value | Out-Null
}
}
Pop-Location
}
@jongio hi, yes tested, and it worked for me 👍
Cool, do you want to do a PR with that code or should I?
Please do 👍
Here: https://github.com/bradygaster/AugmentR/pull/10