forked from mtusi2026/mtusi2026lab4
13 lines
705 B
PowerShell
13 lines
705 B
PowerShell
$ErrorActionPreference = 'Stop'
|
|
New-Item -ItemType Directory -Force secrets | Out-Null
|
|
$values = @{postgres_db='messenger'; postgres_user='messenger'; postgres_password=''; minio_root_user='labadmin'; minio_root_password=''; s3_access_key_id='labapi'; s3_secret_access_key=''}
|
|
foreach ($name in $values.Keys) {
|
|
$path = Join-Path secrets ($name + '.txt')
|
|
if (!(Test-Path -LiteralPath $path)) {
|
|
$value = $values[$name]
|
|
if (!$value) { $value = [Convert]::ToBase64String([System.Security.Cryptography.RandomNumberGenerator]::GetBytes(32)) }
|
|
[System.IO.File]::WriteAllText((Join-Path (Get-Location) $path), $value)
|
|
}
|
|
}
|
|
if (!(Test-Path .env)) { Copy-Item .env.example .env }
|