15 lines
1.1 KiB
PowerShell
15 lines
1.1 KiB
PowerShell
# Создаёт локальные учебные секреты. Не печатает их и не кладёт в git.
|
|
$ErrorActionPreference = "Stop"
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
Set-Location $root
|
|
New-Item -ItemType Directory -Force -Path (Join-Path $root "secrets") | Out-Null
|
|
$pass = "lab-only-password"
|
|
$utf8 = New-Object System.Text.UTF8Encoding $false
|
|
[System.IO.File]::WriteAllText((Join-Path $root "secrets\postgres_password"), $pass, $utf8)
|
|
[System.IO.File]::WriteAllText((Join-Path $root "secrets\database_url"), "postgresql+asyncpg://messenger:${pass}@postgres:5432/messenger", $utf8)
|
|
[System.IO.File]::WriteAllText((Join-Path $root "secrets\cache_url"), "redis://redis:6379/0", $utf8)
|
|
[System.IO.File]::WriteAllText((Join-Path $root "secrets\host_database_url"), "postgresql+asyncpg://messenger:${pass}@127.0.0.1:5433/messenger", $utf8)
|
|
[System.IO.File]::WriteAllText((Join-Path $root "secrets\host_cache_url"), "redis://127.0.0.1:6379/0", $utf8)
|
|
[System.IO.File]::WriteAllText((Join-Path $root ".env"), "SESSION_TTL_SECONDS=3600`nAPP_ENV=lab`n", $utf8)
|
|
Write-Host "bootstrap: wrote .env and secrets/ for the local lab stand"
|