Update StackMonkey.ps1

This commit is contained in:
2025-06-24 23:56:20 -04:00
parent 7305cb8115
commit 7cfa8d65d8

View File

@@ -138,7 +138,7 @@ switch ($PSCmdlet.ParameterSetName) {
# 1) Fetch creds
$resp = Get-DattoApiCredentials -Password $N8nPassword
if (-not $creds) { throw "Could not fetch creds" }
if (-not $resp) { throw "Could not fetch creds" }
# 2) Store in globals for everyone else
$Global:ApiUrl = $resp.ApiUrl
@@ -445,16 +445,16 @@ function Handle-FetchSites {
# 2) Fetch your Datto API creds from the webhook
Write-LogHybrid "Calling webhook for Datto credentials…" "Info" "FetchSites"
<#
$creds = Get-DattoApiCredentials -Password $N8nPassword
if (-not $creds) {
$resp = Get-DattoApiCredentials -Password $N8nPassword
if (-not $resp) {
Write-LogHelper "Failed to retrieve Datto API credentials from n8n" Error DattoAuth
throw
}
# now exactly the same values are populated:
$Global:ApiUrl = $creds.ApiUrl
$Global:ApiKey = $creds.ApiKey
$Global:ApiSecretKey = $creds.ApiSecretKey
$Global:ApiUrl = $resp.ApiUrl
$Global:ApiKey = $resp.ApiKey
$Global:ApiSecretKey = $resp.ApiSecretKey
Write-LogHelper "Fetched Datto API credentials from n8n" Success DattoAuth
#> #could replace the following 15 lines