Backend: - DraftDocument: Claude generates legal documents from case data + template type (14 template types: Klageschrift, UPC claims, Abmahnung, etc.) - CaseStrategy: Opus-powered strategic analysis with next steps, risk assessment, and timeline optimization (structured tool output) - FindSimilarCases: queries youpc.org Supabase for UPC cases, Claude ranks by relevance with explanations and key holdings Endpoints: POST /api/ai/draft-document, /case-strategy, /similar-cases All rate-limited (5 req/min) and permission-gated (PermAIExtraction). YouPC database connection is optional (YOUPC_DATABASE_URL env var).
49 lines
1.2 KiB
Go
49 lines
1.2 KiB
Go
package config
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
type Config struct {
|
|
Port string
|
|
DatabaseURL string
|
|
SupabaseURL string
|
|
SupabaseAnonKey string
|
|
SupabaseServiceKey string
|
|
SupabaseJWTSecret string
|
|
AnthropicAPIKey string
|
|
FrontendOrigin string
|
|
YouPCDatabaseURL string // read-only connection to youpc.org Supabase for similar case finder
|
|
}
|
|
|
|
func Load() (*Config, error) {
|
|
cfg := &Config{
|
|
Port: getEnv("PORT", "8080"),
|
|
DatabaseURL: os.Getenv("DATABASE_URL"),
|
|
SupabaseURL: os.Getenv("SUPABASE_URL"),
|
|
SupabaseAnonKey: os.Getenv("SUPABASE_ANON_KEY"),
|
|
SupabaseServiceKey: os.Getenv("SUPABASE_SERVICE_KEY"),
|
|
SupabaseJWTSecret: os.Getenv("SUPABASE_JWT_SECRET"),
|
|
AnthropicAPIKey: os.Getenv("ANTHROPIC_API_KEY"),
|
|
FrontendOrigin: getEnv("FRONTEND_ORIGIN", "https://kanzlai.msbls.de"),
|
|
YouPCDatabaseURL: os.Getenv("YOUPC_DATABASE_URL"),
|
|
}
|
|
|
|
if cfg.DatabaseURL == "" {
|
|
return nil, fmt.Errorf("DATABASE_URL is required")
|
|
}
|
|
if cfg.SupabaseJWTSecret == "" {
|
|
return nil, fmt.Errorf("SUPABASE_JWT_SECRET is required")
|
|
}
|
|
|
|
return cfg, nil
|
|
}
|
|
|
|
func getEnv(key, fallback string) string {
|
|
if v := os.Getenv(key); v != "" {
|
|
return v
|
|
}
|
|
return fallback
|
|
}
|