update scripts

This commit is contained in:
Fran Jurmanović
2025-07-30 01:58:15 +02:00
parent 90aa63fc99
commit 687b406727
4 changed files with 210 additions and 1 deletions

View File

@@ -158,7 +158,7 @@ if (`$service) {
}
# Create backup of current deployment
`$backupPath = "$DeployPath\backup_`$(Get-Date -Format 'yyyyMMdd_HHmmss')"
`$backupPath = "$DeployPath_backups\backup_`$(Get-Date -Format 'yyyyMMdd_HHmmss')"
if (Test-Path "$DeployPath\$BinaryName.exe") {
Write-Host "Creating backup at: `$backupPath" -ForegroundColor Yellow
New-Item -ItemType Directory -Path `$backupPath -Force | Out-Null

View File

@@ -32,6 +32,7 @@ Write-Host ""
$jwtSecret = Generate-Base64String -Length 64
$appSecret = Generate-HexString -Length 32
$appSecretCode = Generate-HexString -Length 32
$accessKey = Generate-HexString -Length 32
$encryptionKey = Generate-HexString -Length 16
# Display generated secrets
@@ -50,6 +51,9 @@ Write-Host ""
Write-Host "ENCRYPTION_KEY=" -NoNewline -ForegroundColor White
Write-Host $encryptionKey -ForegroundColor Yellow
Write-Host ""
Write-Host "ACCESS_KEY=" -NoNewline -ForegroundColor White
Write-Host $accessKey -ForegroundColor Yellow
Write-Host ""
# Check if .env file exists
$envFile = ".env"
@@ -95,6 +99,8 @@ if ($updateFile) {
$newContent += "APP_SECRET_CODE=$appSecretCode"
} elseif ($line -match "^ENCRYPTION_KEY=") {
$newContent += "ENCRYPTION_KEY=$encryptionKey"
} elseif ($line -match "^ACCESS_KEY=") {
$newContent += "ACCESS_KEY=$accessKey"
} else {
$newContent += $line
}
@@ -117,6 +123,8 @@ if ($updateFile) {
$newContent += "APP_SECRET_CODE=$appSecretCode"
} elseif ($line -match "^ENCRYPTION_KEY=") {
$newContent += "ENCRYPTION_KEY=$encryptionKey"
} elseif ($line -match "^ACCESS_KEY=") {
$newContent += "ACCESS_KEY=$accessKey"
} else {
$newContent += $line
}
@@ -135,6 +143,7 @@ if ($updateFile) {
"APP_SECRET=$appSecret",
"APP_SECRET_CODE=$appSecretCode",
"ENCRYPTION_KEY=$encryptionKey",
"ACCESS_KEY=$accessKey",
"",
"# CORE APPLICATION SETTINGS",
"DB_NAME=acc.db",