feat: add visual settings and readiness gate
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
param(
|
||||
[switch]$Force
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$templatePath = Join-Path $projectRoot ".env.example"
|
||||
$targetPath = Join-Path $projectRoot ".env"
|
||||
|
||||
if ((Test-Path -LiteralPath $targetPath) -and -not $Force) {
|
||||
Write-Host ".env already exists. Use -Force to regenerate it."
|
||||
exit 0
|
||||
}
|
||||
|
||||
function New-SecureHex([int]$byteCount) {
|
||||
$bytes = New-Object byte[] $byteCount
|
||||
$generator = [System.Security.Cryptography.RandomNumberGenerator]::Create()
|
||||
try {
|
||||
$generator.GetBytes($bytes)
|
||||
}
|
||||
finally {
|
||||
$generator.Dispose()
|
||||
}
|
||||
return -join ($bytes | ForEach-Object { $_.ToString("x2") })
|
||||
}
|
||||
|
||||
$postgresPassword = New-SecureHex 24
|
||||
$redisPassword = New-SecureHex 24
|
||||
$content = Get-Content -Raw -Encoding UTF8 -LiteralPath $templatePath
|
||||
$content = $content.Replace("__AUTO_POSTGRES_PASSWORD__", $postgresPassword)
|
||||
$content = $content.Replace("__AUTO_REDIS_PASSWORD__", $redisPassword)
|
||||
|
||||
$utf8WithoutBom = New-Object System.Text.UTF8Encoding($false)
|
||||
[System.IO.File]::WriteAllText($targetPath, $content, $utf8WithoutBom)
|
||||
|
||||
Write-Host "Bootstrap complete: PostgreSQL and Redis passwords were generated securely."
|
||||
Write-Host "Configure MinIO, OCR, AI models, GPU, Langfuse and Sentry in System Settings."
|
||||
Reference in New Issue
Block a user