Skip to content

Commit 5dee2c2

Browse files
committed
add debug env to show some env vars
1 parent 1254f3f commit 5dee2c2

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListApiTest.ps1

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,20 @@ function Invoke-ListApiTest {
77
#>
88
[CmdletBinding()]
99
param($Request, $TriggerMetadata)
10+
11+
$Response = @{}
12+
$Response.Request = $Request
13+
if ($env:DEBUG_ENV_VARS -eq 'true') {
14+
$BlockedKeys = @('ApplicationSecret', 'RefreshToken', 'AzureWebJobsStorage', 'DEPLOYMENT_STORAGE_CONNECTION_STRING')
15+
$EnvironmentVariables = [PSCustomObject]@{}
16+
Get-ChildItem env: | Where-Object { $BlockedKeys -notcontains $_.Name } | ForEach-Object {
17+
$EnvironmentVariables | Add-Member -NotePropertyName $_.Name -NotePropertyValue $_.Value
18+
}
19+
$Response.EnvironmentVariables = $EnvironmentVariables
20+
}
21+
1022
return ([HttpResponseContext]@{
1123
StatusCode = [HttpStatusCode]::OK
12-
Body = ($Request | ConvertTo-Json -Depth 5)
24+
Body = $Response
1325
})
1426
}

0 commit comments

Comments
 (0)