Resolves a threading issue with secrets and vaults by creating a Lockable per vault, and adding Lock-PodeObject wrappers to Get, Set, Read, Update, Remove, and Unlock functions.
Adds inbuilt defaults when using the SecretStore secret vault provider, so it can be more easily used.
Adds documentation for SecretStore, and flags that -UnlockSecret is mandatory.
Related Issue
Resolves #1180
Resolves #1250
Examples
Start-PodeServer -Threads 2 {
Add-PodeEndpoint -Address * -Port 8080 -Protocol Http
# register the vault
Register-PodeSecretVault `
-Name 'ExampleVault' `
-ModuleName 'Microsoft.PowerShell.SecretStore' `
-UnlockSecret 'Sup3rSecur3Pa$$word!'
# set a secret in the local vault
Set-PodeSecret -Key 'example' -Vault 'ExampleVault' -InputObject 'hello, world!'
# mount the "example" secret from local vault, making it accessible via $secret:example
Mount-PodeSecret -Name 'example' -Vault 'ExampleVault' -Key 'example'
# retrieve the secret in a route
Add-PodeRoute -Method Get -Path '/' -ScriptBlock {
Write-PodeJsonResponse @{ Value = $secret:example }
}
# update the secret in a route
Add-PodeRoute -Method Post -Path '/' -ScriptBlock {
$secret:example = $WebEvent.Data.Value
}
}
Description of the Change
Lock-PodeObject
wrappers to Get, Set, Read, Update, Remove, and Unlock functions.-UnlockSecret
is mandatory.Related Issue
Resolves #1180 Resolves #1250
Examples