diff --git a/publish_demo.bat b/publish_demo.bat index 8f9dec8..addff83 100644 --- a/publish_demo.bat +++ b/publish_demo.bat @@ -18,14 +18,8 @@ echo Modalita selezionata: DEMO PUBBLICATA powershell -NoProfile -ExecutionPolicy Bypass -Command ^ "$path = '%CADDYFILE%';" ^ "$content = Get-Content -Raw $path;" ^ - "$pattern = '(?s)%DOMAIN% \{.*?\}';" ^ - "$replacement = @'" ^ -%DOMAIN% { - root * %LIVE_ROOT% - try_files {path} /index.html - file_server -} -'@;" ^ + "$pattern = '(?ms)^%DOMAIN% \{[\s\S]*?^\}';" ^ + "$replacement = '%DOMAIN% {' + [Environment]::NewLine + ' root * %LIVE_ROOT%' + [Environment]::NewLine + ' try_files {path} /index.html' + [Environment]::NewLine + ' file_server' + [Environment]::NewLine + '}';" ^ "$updated = [regex]::Replace($content, $pattern, $replacement);" ^ "Set-Content -Path $path -Value $updated -Encoding UTF8;" if errorlevel 1 ( @@ -39,13 +33,8 @@ echo Modalita selezionata: COMING SOON powershell -NoProfile -ExecutionPolicy Bypass -Command ^ "$path = '%CADDYFILE%';" ^ "$content = Get-Content -Raw $path;" ^ - "$pattern = '(?s)%DOMAIN% \{.*?\}';" ^ - "$replacement = @'" ^ -%DOMAIN% { - root * %COMING_SOON_ROOT% - file_server -} -'@;" ^ + "$pattern = '(?ms)^%DOMAIN% \{[\s\S]*?^\}';" ^ + "$replacement = '%DOMAIN% {' + [Environment]::NewLine + ' root * %COMING_SOON_ROOT%' + [Environment]::NewLine + ' file_server' + [Environment]::NewLine + '}';" ^ "$updated = [regex]::Replace($content, $pattern, $replacement);" ^ "Set-Content -Path $path -Value $updated -Encoding UTF8;" if errorlevel 1 (