56 lines
1.9 KiB
PowerShell
56 lines
1.9 KiB
PowerShell
# Script para adicionar domínios locais ao arquivo hosts
|
|
# Execute como Administrador
|
|
|
|
$hostsFile = "C:\Windows\System32\drivers\etc\hosts"
|
|
$domains = @(
|
|
"127.0.0.1 dash.localhost",
|
|
"127.0.0.1 aggios.local",
|
|
"127.0.0.1 api.localhost",
|
|
"127.0.0.1 files.localhost",
|
|
"127.0.0.1 agency.localhost"
|
|
)
|
|
|
|
Write-Host "=== Configurando arquivo hosts para Aggios ===" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# Verificar se já existem as entradas
|
|
$hostsContent = Get-Content $hostsFile -ErrorAction SilentlyContinue
|
|
|
|
$needsUpdate = $false
|
|
foreach ($domain in $domains) {
|
|
$domainName = $domain.Split()[1]
|
|
if ($hostsContent -notmatch $domainName) {
|
|
Write-Host "✓ Adicionando: $domain" -ForegroundColor Green
|
|
$needsUpdate = $true
|
|
} else {
|
|
Write-Host "→ Já existe: $domainName" -ForegroundColor Yellow
|
|
}
|
|
}
|
|
|
|
if ($needsUpdate) {
|
|
Write-Host ""
|
|
Write-Host "Adicionando entradas ao arquivo hosts..." -ForegroundColor Cyan
|
|
|
|
$newContent = @()
|
|
$newContent += "`n# === Aggios Local Development ==="
|
|
$newContent += $domains
|
|
$newContent += "# === Fim Aggios ===`n"
|
|
|
|
Add-Content -Path $hostsFile -Value ($newContent -join "`n")
|
|
|
|
Write-Host ""
|
|
Write-Host "✓ Arquivo hosts atualizado com sucesso!" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "Você pode agora acessar:" -ForegroundColor Cyan
|
|
Write-Host " • Dashboard: http://dash.localhost/cadastro" -ForegroundColor White
|
|
Write-Host " • API: http://api.localhost/api/health" -ForegroundColor White
|
|
Write-Host " • Institucional: http://aggios.local" -ForegroundColor White
|
|
} else {
|
|
Write-Host ""
|
|
Write-Host "✓ Todas as entradas já estão configuradas!" -ForegroundColor Green
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "Pressione qualquer tecla para continuar..."
|
|
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|