Major security, observability, and configuration improvements:
## Security Hardening
- Implemented configurable CORS (no more wildcards)
- Added comprehensive auth middleware for admin endpoints
- Enhanced webhook HMAC validation
- Added input validation and rate limiting
- Security headers and CSP policies
## Configuration Management
- Made N8N webhook URL configurable (WHOOSH_N8N_BASE_URL)
- Replaced all hardcoded endpoints with environment variables
- Added feature flags for LLM vs heuristic composition
- Gitea fetch hardening with EAGER_FILTER and FULL_RESCAN options
## API Completeness
- Implemented GetCouncilComposition function
- Added GET /api/v1/councils/{id} endpoint
- Council artifacts API (POST/GET /api/v1/councils/{id}/artifacts)
- /admin/health/details endpoint with component status
- Database lookup for repository URLs (no hardcoded fallbacks)
## Observability & Performance
- Added OpenTelemetry distributed tracing with goal/pulse correlation
- Performance optimization database indexes
- Comprehensive health monitoring
- Enhanced logging and error handling
## Infrastructure
- Production-ready P2P discovery (replaces mock implementation)
- Removed unused Redis configuration
- Enhanced Docker Swarm integration
- Added migration files for performance indexes
## Code Quality
- Comprehensive input validation
- Graceful error handling and failsafe fallbacks
- Backwards compatibility maintained
- Following security best practices
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
65 lines
1.5 KiB
Go
65 lines
1.5 KiB
Go
package zerolog
|
|
|
|
// Hook defines an interface to a log hook.
|
|
type Hook interface {
|
|
// Run runs the hook with the event.
|
|
Run(e *Event, level Level, message string)
|
|
}
|
|
|
|
// HookFunc is an adaptor to allow the use of an ordinary function
|
|
// as a Hook.
|
|
type HookFunc func(e *Event, level Level, message string)
|
|
|
|
// Run implements the Hook interface.
|
|
func (h HookFunc) Run(e *Event, level Level, message string) {
|
|
h(e, level, message)
|
|
}
|
|
|
|
// LevelHook applies a different hook for each level.
|
|
type LevelHook struct {
|
|
NoLevelHook, TraceHook, DebugHook, InfoHook, WarnHook, ErrorHook, FatalHook, PanicHook Hook
|
|
}
|
|
|
|
// Run implements the Hook interface.
|
|
func (h LevelHook) Run(e *Event, level Level, message string) {
|
|
switch level {
|
|
case TraceLevel:
|
|
if h.TraceHook != nil {
|
|
h.TraceHook.Run(e, level, message)
|
|
}
|
|
case DebugLevel:
|
|
if h.DebugHook != nil {
|
|
h.DebugHook.Run(e, level, message)
|
|
}
|
|
case InfoLevel:
|
|
if h.InfoHook != nil {
|
|
h.InfoHook.Run(e, level, message)
|
|
}
|
|
case WarnLevel:
|
|
if h.WarnHook != nil {
|
|
h.WarnHook.Run(e, level, message)
|
|
}
|
|
case ErrorLevel:
|
|
if h.ErrorHook != nil {
|
|
h.ErrorHook.Run(e, level, message)
|
|
}
|
|
case FatalLevel:
|
|
if h.FatalHook != nil {
|
|
h.FatalHook.Run(e, level, message)
|
|
}
|
|
case PanicLevel:
|
|
if h.PanicHook != nil {
|
|
h.PanicHook.Run(e, level, message)
|
|
}
|
|
case NoLevel:
|
|
if h.NoLevelHook != nil {
|
|
h.NoLevelHook.Run(e, level, message)
|
|
}
|
|
}
|
|
}
|
|
|
|
// NewLevelHook returns a new LevelHook.
|
|
func NewLevelHook() LevelHook {
|
|
return LevelHook{}
|
|
}
|