feat: deploy.ps1 para Windows en los 4 packs + INSTALL.md #1

Merged
hermes merged 3 commits from feat/windows-powershell into main 2026-09-12 19:08:48 +02:00
4 changed files with 32 additions and 13 deletions
Showing only changes of commit 6c3a594a14 - Show all commits

No files matched your search

+4 -2
View File
@@ -15,8 +15,10 @@ param(
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
$Green = "`e[32m"; $Cyan = "`e[36m"; $Yellow = "`e[33m"; $Red = "`e[31m"; $Bold = "`e[1m"; $NC = "`e[0m" # Escape ANSI via [char]27 (compatible con Windows PowerShell 5.1 y PS 7+)
if ($env:NO_COLOR -or -not $PSStyle) { $Esc = [char]27
$Green = "$Esc[32m"; $Cyan = "$Esc[36m"; $Yellow = "$Esc[33m"; $Red = "$Esc[31m"; $Bold = "$Esc[1m"; $NC = "$Esc[0m"
if ($env:NO_COLOR) {
$Green = $Cyan = $Yellow = $Red = $Bold = $NC = '' $Green = $Cyan = $Yellow = $Red = $Bold = $NC = ''
} }
+4 -2
View File
@@ -15,8 +15,10 @@ param(
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
$Green = "`e[32m"; $Cyan = "`e[36m"; $Yellow = "`e[33m"; $Red = "`e[31m"; $Bold = "`e[1m"; $NC = "`e[0m" # Escape ANSI via [char]27 (compatible con Windows PowerShell 5.1 y PS 7+)
if ($env:NO_COLOR -or -not $PSStyle) { $Esc = [char]27
$Green = "$Esc[32m"; $Cyan = "$Esc[36m"; $Yellow = "$Esc[33m"; $Red = "$Esc[31m"; $Bold = "$Esc[1m"; $NC = "$Esc[0m"
if ($env:NO_COLOR) {
$Green = $Cyan = $Yellow = $Red = $Bold = $NC = '' $Green = $Cyan = $Yellow = $Red = $Bold = $NC = ''
} }
+4 -2
View File
@@ -15,8 +15,10 @@ param(
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
$Green = "`e[32m"; $Cyan = "`e[36m"; $Yellow = "`e[33m"; $Red = "`e[31m"; $Bold = "`e[1m"; $NC = "`e[0m" # Escape ANSI via [char]27 (compatible con Windows PowerShell 5.1 y PS 7+)
if ($env:NO_COLOR -or -not $PSStyle) { $Esc = [char]27
$Green = "$Esc[32m"; $Cyan = "$Esc[36m"; $Yellow = "$Esc[33m"; $Red = "$Esc[31m"; $Bold = "$Esc[1m"; $NC = "$Esc[0m"
if ($env:NO_COLOR) {
$Green = $Cyan = $Yellow = $Red = $Bold = $NC = '' $Green = $Cyan = $Yellow = $Red = $Bold = $NC = ''
} }
+20 -7
View File
@@ -15,8 +15,10 @@ param(
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
$Green = "`e[32m"; $Cyan = "`e[36m"; $Yellow = "`e[33m"; $Red = "`e[31m"; $Bold = "`e[1m"; $NC = "`e[0m" # Escape ANSI via [char]27 (compatible con Windows PowerShell 5.1 y PS 7+)
if ($env:NO_COLOR -or -not $PSStyle) { $Esc = [char]27
$Green = "$Esc[32m"; $Cyan = "$Esc[36m"; $Yellow = "$Esc[33m"; $Red = "$Esc[31m"; $Bold = "$Esc[1m"; $NC = "$Esc[0m"
if ($env:NO_COLOR) {
$Green = $Cyan = $Yellow = $Red = $Bold = $NC = '' $Green = $Cyan = $Yellow = $Red = $Bold = $NC = ''
} }
@@ -92,11 +94,22 @@ if (-not (Test-Path $EnvFile)) {
$rng.GetBytes($Bytes); $WpPass = ($Bytes | ForEach-Object { $_.ToString('x2') }) -join '' $rng.GetBytes($Bytes); $WpPass = ($Bytes | ForEach-Object { $_.ToString('x2') }) -join ''
$rng.Dispose() $rng.Dispose()
# La 1a coincidencia es MYSQL_ROOT_PASSWORD, la 2a MYSQL_PASSWORD (orden del .env.example) # 1a coincidencia en el fichero = MYSQL_ROOT_PASSWORD, 2a = MYSQL_PASSWORD.
$Content = Get-Content $EnvFile -Raw # -replace no acepta tercer operando (count) en ninguna version de PS,
$Content = $Content -replace 'change-me-to-a-strong-password', $RootPass, 1 # asi que se recorre linea a linea.
$Content = $Content -replace 'change-me-to-a-strong-password', $WpPass, 1 $Lines = Get-Content $EnvFile
Set-Content $EnvFile -Value $Content -NoNewline $Replaced = 0
for ($i = 0; $i -lt $Lines.Count; $i++) {
if ($Lines[$i] -like '*change-me-to-a-strong-password*') {
if ($Replaced -eq 0) {
$Lines[$i] = $Lines[$i] -replace 'change-me-to-a-strong-password', $RootPass
} else {
$Lines[$i] = $Lines[$i] -replace 'change-me-to-a-strong-password', $WpPass
}
$Replaced++
}
}
Set-Content $EnvFile -Value $Lines
Info "Contrasenas generadas en $EnvFile" Info "Contrasenas generadas en $EnvFile"
} }