2021-10-13 19:30:03 +02:00
|
|
|
#!/usr/bin/env pwsh
|
|
|
|
# Helper script for applying the same user secrets to each project
|
|
|
|
param (
|
2023-09-14 14:39:13 +02:00
|
|
|
[switch]$clear,
|
2021-10-13 19:30:03 +02:00
|
|
|
[Parameter(ValueFromRemainingArguments = $true, Position=1)]
|
|
|
|
$cmdArgs
|
|
|
|
)
|
|
|
|
|
|
|
|
if (!(Test-Path "secrets.json")) {
|
|
|
|
Write-Warning "No secrets.json file found, please copy and modify the provided example";
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2021-11-02 22:12:43 +01:00
|
|
|
if ($clear -eq $true) {
|
|
|
|
Write-Output "Deleting all existing user secrets"
|
|
|
|
}
|
|
|
|
|
|
|
|
$projects = @{
|
|
|
|
Admin = "../src/Admin"
|
|
|
|
Api = "../src/Api"
|
|
|
|
Billing = "../src/Billing"
|
|
|
|
Events = "../src/Events"
|
|
|
|
EventsProcessor = "../src/EventsProcessor"
|
|
|
|
Icons = "../src/Icons"
|
|
|
|
Identity = "../src/Identity"
|
|
|
|
Notifications = "../src/Notifications"
|
|
|
|
Sso = "../bitwarden_license/src/Sso"
|
2022-07-14 21:58:48 +02:00
|
|
|
Scim = "../bitwarden_license/src/Scim"
|
2021-11-02 22:12:43 +01:00
|
|
|
}
|
2021-10-13 19:30:03 +02:00
|
|
|
|
2021-11-02 22:12:43 +01:00
|
|
|
foreach ($key in $projects.keys) {
|
2021-10-13 19:30:03 +02:00
|
|
|
if ($clear -eq $true) {
|
2021-11-02 22:12:43 +01:00
|
|
|
dotnet user-secrets clear -p $projects[$key]
|
2021-10-13 19:30:03 +02:00
|
|
|
}
|
2021-11-02 22:12:43 +01:00
|
|
|
$output = Get-Content secrets.json | & dotnet user-secrets set -p $projects[$key]
|
|
|
|
Write-Output "$output - $key"
|
2021-10-13 19:30:03 +02:00
|
|
|
}
|