- scripts/Invoke-CloudflareApi.ps1: control de tunnel/DNS via API - scripts/Install-CoolifyAutostart.ps1 + scripts/host/: autostart de LXC 102 + tunnel tras corte - scripts/Apply-ChatwootEnterprisePatch.ps1: parche enterprise (autodetecta creds) - Deploy-SoloLeveling.ps1: deploy build-on-server verificado - docs/runbooks/cloudflare-tunnel.md y autostart-coolify.md - docs/casos/chatwoot-enterprise-patch.md (credenciales redactadas) - docs/AGENTS-coolify-apps.md + issues y reportes - deploy_skill/references/coolify-4.1.2-notes.md: hallazgos verificados (seccion 7) - package.json para verify-online.mjs del coolify-deploy skill - .gitignore: excluye .claude/ y .opencode/ (config local de herramientas)
67 lines
1.3 KiB
PowerShell
67 lines
1.3 KiB
PowerShell
param(
|
|
[ValidateSet("GET", "POST", "PUT", "PATCH", "DELETE")]
|
|
[string]$Method = "GET",
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$Path,
|
|
|
|
[string]$BodyJson,
|
|
|
|
[switch]$Raw
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$baseUrl = if ($env:COOLIFY_API_URL) {
|
|
$env:COOLIFY_API_URL
|
|
}
|
|
else {
|
|
"https://coolify.urieljareth.org/api/v1"
|
|
}
|
|
|
|
if ([string]::IsNullOrWhiteSpace($env:COOLIFY_TOKEN)) {
|
|
throw "Set COOLIFY_TOKEN before calling the Coolify API."
|
|
}
|
|
|
|
$baseUrl = $baseUrl.TrimEnd("/")
|
|
$cleanPath = if ($Path.StartsWith("/")) { $Path } else { "/$Path" }
|
|
$uri = "$baseUrl$cleanPath"
|
|
|
|
$headers = @{
|
|
Authorization = "Bearer $($env:COOLIFY_TOKEN)"
|
|
Accept = "application/json"
|
|
}
|
|
|
|
$request = @{
|
|
Method = $Method
|
|
Uri = $uri
|
|
Headers = $headers
|
|
TimeoutSec = 240
|
|
}
|
|
|
|
if ($PSBoundParameters.ContainsKey("BodyJson")) {
|
|
try {
|
|
$null = $BodyJson | ConvertFrom-Json
|
|
}
|
|
catch {
|
|
throw "BodyJson is not valid JSON: $($_.Exception.Message)"
|
|
}
|
|
|
|
$request.Body = $BodyJson
|
|
$request.ContentType = "application/json"
|
|
}
|
|
|
|
try {
|
|
$response = Invoke-RestMethod @request
|
|
}
|
|
catch {
|
|
throw "Coolify API request failed: $($_.Exception.Message)"
|
|
}
|
|
|
|
if ($Raw) {
|
|
$response
|
|
}
|
|
else {
|
|
$response | ConvertTo-Json -Depth 50
|
|
}
|