Lab2: PostgreSQL, Bearer sessions and Redis for grade 4

This commit is contained in:
2026-10-29 23:22:15 +03:00
parent 65003b6119
commit 0406baab3f
49 changed files with 3096 additions and 16 deletions
+14
View File
@@ -0,0 +1,14 @@
# Создаёт локальные учебные секреты. Не печатает их и не кладёт в 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"