50 lines
2.4 KiB
PowerShell
50 lines
2.4 KiB
PowerShell
$ErrorActionPreference = "Continue"
|
|
Write-Host "=== run-ledger-inner redis bits ==="
|
|
Get-Content "E:\wwwroot\ops\run-ledger-inner.ps1" | Select-Object -First 55 | ForEach-Object { Write-Host $_ }
|
|
|
|
$env:YTD_REDIS_PASSWORD = $null
|
|
Get-Content "E:\wwwroot\.env" | ForEach-Object {
|
|
$t = $_.Trim()
|
|
if (-not $t -or $t.StartsWith("#")) { return }
|
|
$i = $t.IndexOf("=")
|
|
if ($i -lt 1) { return }
|
|
Set-Item -Path ("Env:" + $t.Substring(0,$i).Trim()) -Value $t.Substring($i+1).Trim().Trim("`"")
|
|
}
|
|
$ulen = 0; if ($env:YTD_REDIS_USERNAME) { $ulen = $env:YTD_REDIS_USERNAME.Length }
|
|
$plen = 0; if ($env:YTD_REDIS_PASSWORD) { $plen = $env:YTD_REDIS_PASSWORD.Length }
|
|
$ulen2 = 0; $rlen = 0; if ($env:REDIS_URL) { $rlen = $env:REDIS_URL.Length }
|
|
Write-Host ("before_parse user_len=$ulen pw_len=$plen url_len=$rlen")
|
|
|
|
if (-not $env:YTD_REDIS_PASSWORD -and $env:REDIS_URL) {
|
|
if ($env:REDIS_URL -match "redis://:([^@]+)@") {
|
|
$env:YTD_REDIS_PASSWORD = $Matches[1]
|
|
Write-Host "matched_form_password_only"
|
|
} elseif ($env:REDIS_URL -match "redis://([^:/@]+):([^@]+)@") {
|
|
if (-not $env:YTD_REDIS_USERNAME) { $env:YTD_REDIS_USERNAME = $Matches[1] }
|
|
$env:YTD_REDIS_PASSWORD = $Matches[2]
|
|
Write-Host "matched_form_user_pass"
|
|
} elseif ($env:REDIS_URL -match "redis://[^:]+:([^@]+)@") {
|
|
$env:YTD_REDIS_PASSWORD = $Matches[1]
|
|
Write-Host "matched_form_legacy"
|
|
} else {
|
|
Write-Host "NO_REGEX_MATCH"
|
|
}
|
|
}
|
|
$ulen = 0; if ($env:YTD_REDIS_USERNAME) { $ulen = $env:YTD_REDIS_USERNAME.Length }
|
|
$plen = 0; if ($env:YTD_REDIS_PASSWORD) { $plen = $env:YTD_REDIS_PASSWORD.Length }
|
|
Write-Host ("after_parse user_len=$ulen pw_len=$plen")
|
|
if ($env:REDIS_URL) {
|
|
$u = $env:REDIS_URL
|
|
$at = ([regex]::Matches($u,"@")).Count
|
|
$auth = $u.Substring(8).Split("@")[0]
|
|
$parts = $auth.Split(":").Count
|
|
Write-Host ("url_probe at_count=$at auth_colon_parts=$parts")
|
|
}
|
|
|
|
$login = Invoke-RestMethod -Uri "http://127.0.0.1:8180/jeecgboot/sys/login" -Method POST -Body "{\"username\":\"admin\",\"password\":\"123456\",\"captcha\":\"\",\"checkKey\":\"\"}" -ContentType "application/json;charset=UTF-8"
|
|
$h = @{ "X-Access-Token" = $login.result.token }
|
|
$r = Invoke-WebRequest -Uri "http://127.0.0.1:8180/jeecgboot/inquiry/quoteTemplate/list?pageNo=1&pageSize=5" -Headers $h -UseBasicParsing
|
|
Write-Host "=== list ==="
|
|
$n = [Math]::Min(600, $r.Content.Length)
|
|
Write-Host $r.Content.Substring(0, $n)
|
|
Write-Host "PARSE_CHECK_DONE" |