Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
27 lines
860 B
PowerShell
27 lines
860 B
PowerShell
# Load monorepo-root .env and run the API or worker (go run).
|
|
# Usage: .\scripts\run-api.ps1 [worker]
|
|
$ErrorActionPreference = "Stop"
|
|
$Root = Resolve-Path (Join-Path $PSScriptRoot "..")
|
|
$ApiDir = Join-Path $Root "apps\api"
|
|
$envFile = Join-Path $Root ".env"
|
|
if (Test-Path $envFile) {
|
|
Get-Content $envFile | ForEach-Object {
|
|
if ($_ -match '^\s*#' -or $_ -match '^\s*$') { return }
|
|
$line = $_
|
|
if ($line -match '^\s*export\s+') { $line = $line -replace '^\s*export\s+', '' }
|
|
$kv = $line -split '=', 2
|
|
if ($kv.Length -eq 2) {
|
|
$name = $kv[0].Trim()
|
|
if (-not [string]::IsNullOrWhiteSpace($name) -and -not (Test-Path "Env:$name")) {
|
|
Set-Item -Path "Env:$name" -Value $kv[1].Trim().Trim('"').Trim("'")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Set-Location $ApiDir
|
|
if ($args -contains "worker") {
|
|
go run ./cmd/worker
|
|
} else {
|
|
go run ./cmd/api
|
|
}
|