30 lines
1.1 KiB
PowerShell
30 lines
1.1 KiB
PowerShell
# PowerShell script to load .env and run Spring Boot application
|
|
|
|
Write-Host "Loading environment from .env file..." -ForegroundColor Green
|
|
|
|
# Load .env file
|
|
if (Test-Path ".env") {
|
|
Get-Content ".env" | ForEach-Object {
|
|
# Skip comments and empty lines
|
|
if ($_ -notmatch '^\s*#' -and $_ -match '=') {
|
|
$name, $value = $_ -split '=', 2
|
|
$name = $name.Trim()
|
|
$value = $value.Trim()
|
|
[Environment]::SetEnvironmentVariable($name, $value, "Process")
|
|
Write-Host " Set $name" -ForegroundColor Gray
|
|
}
|
|
}
|
|
Write-Host ""
|
|
Write-Host "Starting Group Ironmen Backend..." -ForegroundColor Green
|
|
Write-Host "Database: $env:DB_USER@$env:DB_HOST`:$env:DB_PORT/$env:DB_NAME" -ForegroundColor Cyan
|
|
Write-Host "Server Port: $env:SERVER_PORT" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# Run the application
|
|
& .\gradlew.bat bootRun
|
|
} else {
|
|
Write-Host "Error: .env file not found!" -ForegroundColor Red
|
|
Write-Host "Please create a .env file with your database configuration." -ForegroundColor Yellow
|
|
exit 1
|
|
}
|