1
This commit is contained in:
@@ -9,7 +9,7 @@ param(
|
||||
[string]$SpacetimeHost = "127.0.0.1",
|
||||
[int]$SpacetimePort = 3101,
|
||||
[string]$SpacetimeRootDir = "",
|
||||
[string]$Database = "genarrative-dev",
|
||||
[string]$Database = "",
|
||||
[string]$Log = "info,tower_http=info",
|
||||
[int]$SpacetimeStartupTimeoutSeconds = 60,
|
||||
[switch]$SkipSpacetime,
|
||||
@@ -65,6 +65,28 @@ function Resolve-ClientHost {
|
||||
return $HostName
|
||||
}
|
||||
|
||||
function Read-LocalSpacetimeDatabase {
|
||||
param([string]$RepoRoot)
|
||||
|
||||
$localConfigPath = Join-Path $RepoRoot "spacetime.local.json"
|
||||
if (-not (Test-Path $localConfigPath)) {
|
||||
return ""
|
||||
}
|
||||
|
||||
try {
|
||||
$localConfig = Get-Content -Path $localConfigPath -Encoding UTF8 -Raw | ConvertFrom-Json
|
||||
$database = [string]$localConfig.database
|
||||
if (-not [string]::IsNullOrWhiteSpace($database)) {
|
||||
return $database.Trim()
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Host "[dev:rust] ignore invalid spacetime.local.json: $($_.Exception.Message)"
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
function Start-StackProcess {
|
||||
param(
|
||||
[string]$Name,
|
||||
@@ -165,6 +187,14 @@ if ([string]::IsNullOrWhiteSpace($SpacetimeRootDir)) {
|
||||
$SpacetimeRootDir = Join-Path $serverRsDir ".spacetimedb\local"
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($Database)) {
|
||||
$Database = Read-LocalSpacetimeDatabase -RepoRoot $repoRoot
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($Database)) {
|
||||
$Database = "genarrative-dev"
|
||||
}
|
||||
|
||||
if (-not (Test-Path $manifestPath)) {
|
||||
throw "Missing server-rs/Cargo.toml, cannot start Rust local stack."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user