File size: 1,747 Bytes
5a81b95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# WidgeTDC Windows Deployment Script
Write-Host "Starting WidgeTDC Deployment Protocol (Windows Mode)..." -ForegroundColor Cyan

# 1. Setup Directories
$DataDir = ".\data"
$CivicSchemaDir = "$DataDir\civic_schema"
$ThreatFeedDir = "$DataDir\threat_feeds"
$SourceIntelDir = ".\source_intel"

if (-not (Test-Path $CivicSchemaDir)) { New-Item -ItemType Directory -Force -Path $CivicSchemaDir | Out-Null }
if (-not (Test-Path $ThreatFeedDir)) { New-Item -ItemType Directory -Force -Path $ThreatFeedDir | Out-Null }

# 2. Data Sanitization
$SourceSql = "$DataDir\full_schema.sql"
$TargetSql = "$CivicSchemaDir\init.sql"

if (Test-Path $SourceSql) {
    Write-Host "Scrubbing 'full_schema.sql'..." -ForegroundColor Yellow
    $content = Get-Content $SourceSql -Raw
    $content = $content -replace 'cia_user', 'civic_reader'
    $content = $content -replace 'cia', 'civic_vault'
    $content = $content -replace 'Citizen Intelligence Agency', 'Civic Insight Node'
    Set-Content -Path $TargetSql -Value $content
    Write-Host "[OK] Civic Vault Sanitized." -ForegroundColor Green
} else {
    Write-Host "[WARN] 'full_schema.sql' not found. Civic Node will start empty." -ForegroundColor Red
    "CREATE TABLE IF NOT EXISTS system_status (status VARCHAR(50));" | Set-Content $TargetSql
}

# 3. Threat Feed Staging
if (Test-Path $SourceIntelDir) {
    $feeds = Get-ChildItem "$SourceIntelDir\*.md"
    if ($feeds) {
        Write-Host "Staging Threat Intelligence..." -ForegroundColor Yellow
        Copy-Item "$SourceIntelDir\*.md" -Destination $ThreatFeedDir -Force
        Write-Host "[OK] Intel Feeds staged." -ForegroundColor Green
    }
}

# 4. Launch Docker
Write-Host "Launching Containers..." -ForegroundColor Cyan
docker-compose up -d --build