This repository has been archived on 2026-02-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
BreakPilot Dev 19855efacc
Some checks failed
Tests / Go Tests (push) Has been cancelled
Tests / Python Tests (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / Go Lint (push) Has been cancelled
Tests / Python Lint (push) Has been cancelled
Tests / Security Scan (push) Has been cancelled
Tests / All Checks Passed (push) Has been cancelled
Security Scanning / Secret Scanning (push) Has been cancelled
Security Scanning / Dependency Vulnerability Scan (push) Has been cancelled
Security Scanning / Go Security Scan (push) Has been cancelled
Security Scanning / Python Security Scan (push) Has been cancelled
Security Scanning / Node.js Security Scan (push) Has been cancelled
Security Scanning / Docker Image Security (push) Has been cancelled
Security Scanning / Security Summary (push) Has been cancelled
CI/CD Pipeline / Go Tests (push) Has been cancelled
CI/CD Pipeline / Python Tests (push) Has been cancelled
CI/CD Pipeline / Website Tests (push) Has been cancelled
CI/CD Pipeline / Linting (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Docker Build & Push (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / CI Summary (push) Has been cancelled
ci/woodpecker/manual/build-ci-image Pipeline was successful
ci/woodpecker/manual/main Pipeline failed
feat: BreakPilot PWA - Full codebase (clean push without large binaries)
All services: admin-v2, studio-v2, website, ai-compliance-sdk,
consent-service, klausur-service, voice-service, and infrastructure.
Large PDFs and compiled binaries excluded via .gitignore.
2026-02-11 13:25:58 +01:00

104 lines
2.5 KiB
Go

// BreakPilot Compliance SDK - Compliance Engine
//
// UCCA (Unified Compliance Control Assessment) Engine
// Evaluates compliance state against 45+ policy rules
package main
import (
"context"
"log"
"net/http"
"os"
"os/signal"
"syscall"
"time"
"github.com/breakpilot/compliance-sdk/services/compliance-engine/internal/api"
"github.com/breakpilot/compliance-sdk/services/compliance-engine/internal/ucca"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
func main() {
logger, _ := zap.NewProduction()
defer logger.Sync()
// Load UCCA policies
engine, err := ucca.NewEngine("policies")
if err != nil {
logger.Fatal("Failed to load UCCA policies", zap.Error(err))
}
logger.Info("UCCA Engine initialized", zap.Int("rules", engine.RuleCount()))
// Set Gin mode
if os.Getenv("ENVIRONMENT") == "production" {
gin.SetMode(gin.ReleaseMode)
}
router := gin.New()
router.Use(gin.Recovery())
// Health check
router.GET("/health", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"status": "healthy",
"service": "compliance-engine",
"rules": engine.RuleCount(),
})
})
// API routes
v1 := router.Group("/api/v1")
{
// Assessment
v1.POST("/assess", api.Assess(engine))
v1.POST("/assess/control", api.AssessControl(engine))
v1.POST("/assess/regulation", api.AssessRegulation(engine))
// Score calculation
v1.POST("/score", api.CalculateScore(engine))
v1.POST("/score/breakdown", api.ScoreBreakdown(engine))
// Obligations
v1.GET("/obligations", api.GetObligations(engine))
v1.GET("/obligations/:regulation", api.GetObligationsByRegulation(engine))
// Controls catalog
v1.GET("/controls", api.GetControlsCatalog(engine))
v1.GET("/controls/:domain", api.GetControlsByDomain(engine))
// Policies
v1.GET("/policies", api.ListPolicies(engine))
v1.GET("/policies/:id", api.GetPolicy(engine))
}
port := os.Getenv("PORT")
if port == "" {
port = "8081"
}
srv := &http.Server{
Addr: ":" + port,
Handler: router,
ReadTimeout: 15 * time.Second,
WriteTimeout: 15 * time.Second,
}
go func() {
logger.Info("Starting Compliance Engine", zap.String("port", port))
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
logger.Fatal("Failed to start server", zap.Error(err))
}
}()
quit := make(chan os.Signal, 1)
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
<-quit
logger.Info("Shutting down...")
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
srv.Shutdown(ctx)
}