-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.ps1
More file actions
48 lines (41 loc) · 1.73 KB
/
dev.ps1
File metadata and controls
48 lines (41 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Hot reloading dev script for Rust HTTP server
# This will watch for file changes and automatically rebuild and restart the server
Write-Host "Killing processes on port 3000..." -ForegroundColor Yellow
# Find and kill processes using port 3000
$processes = netstat -ano | findstr :3000
if ($processes) {
$processes | ForEach-Object {
$parts = $_ -split '\s+'
$processId = $parts[-1]
if ($processId -match '^\d+$') {
Write-Host "Killing process $processId on port 3000..." -ForegroundColor Red
taskkill /PID $processId /F 2>$null
}
}
Start-Sleep -Seconds 1
Write-Host "Port 3000 cleared!" -ForegroundColor Green
} else {
Write-Host "No processes found on port 3000" -ForegroundColor Green
}
Write-Host "`nStarting hot reloading dev server..." -ForegroundColor Green
Write-Host "Make sure cargo-watch is installed: cargo install cargo-watch" -ForegroundColor Yellow
# Load .env file if it exists
if (Test-Path .env) {
Write-Host "Loading .env file..." -ForegroundColor Cyan
Get-Content .env | ForEach-Object {
if ($_ -match '^\s*([^#][^=]*)=(.*)$') {
$name = $matches[1].Trim()
$value = $matches[2].Trim()
[Environment]::SetEnvironmentVariable($name, $value, "Process")
}
}
}
# Check if REDIS_URL is set
if (-not $env:REDIS_URL) {
Write-Host "`nWARNING: REDIS_URL not set!" -ForegroundColor Red
Write-Host "Set REDIS_URL with your Railway Redis connection string:" -ForegroundColor Yellow
Write-Host " Example: rediss://:password@hopper.proxy.rlwy.net:29794" -ForegroundColor Yellow
Write-Host " Or set REDIS_HOST, REDIS_PORT, and REDIS_PASSWORD" -ForegroundColor Yellow
Write-Host ""
}
cargo watch -x run