Add webhook logging, pagination, middleware, migrations, and prod hardening
- Webhook event logging repo and subscription webhook idempotency - Pagination helper (echohelpers) with cursor/offset support - Request ID and structured logging middleware - Push client improvements (FCM HTTP v1, better error handling) - Task model version column, business constraint migrations, targeted indexes - Expanded categorization chain tests - Email service and config hardening - CI workflow updates, .gitignore additions, .env.example updates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -111,7 +111,7 @@ func main() {
|
||||
Int("email_port", cfg.Email.Port).
|
||||
Msg("Email config loaded")
|
||||
if cfg.Email.Host != "" && cfg.Email.User != "" {
|
||||
emailService = services.NewEmailService(&cfg.Email)
|
||||
emailService = services.NewEmailService(&cfg.Email, cfg.Features.EmailEnabled)
|
||||
log.Info().
|
||||
Str("host", cfg.Email.Host).
|
||||
Msg("Email service initialized")
|
||||
@@ -143,7 +143,7 @@ func main() {
|
||||
|
||||
// Initialize push notification client (APNs + FCM)
|
||||
var pushClient *push.Client
|
||||
pushClient, err = push.NewClient(&cfg.Push)
|
||||
pushClient, err = push.NewClient(&cfg.Push, cfg.Features.PushEnabled)
|
||||
if err != nil {
|
||||
log.Warn().Err(err).Msg("Failed to initialize push client - push notifications disabled")
|
||||
} else {
|
||||
|
||||
@@ -31,6 +31,12 @@ func main() {
|
||||
log.Fatal().Err(err).Msg("Failed to load configuration")
|
||||
}
|
||||
|
||||
// Check worker kill switch
|
||||
if !cfg.Features.WorkerEnabled {
|
||||
log.Warn().Msg("Worker disabled by FEATURE_WORKER_ENABLED=false — exiting")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
// Initialize database
|
||||
db, err := database.Connect(&cfg.Database, cfg.Server.Debug)
|
||||
if err != nil {
|
||||
@@ -44,7 +50,7 @@ func main() {
|
||||
|
||||
// Initialize push client (APNs + FCM)
|
||||
var pushClient *push.Client
|
||||
pushClient, err = push.NewClient(&cfg.Push)
|
||||
pushClient, err = push.NewClient(&cfg.Push, cfg.Features.PushEnabled)
|
||||
if err != nil {
|
||||
log.Warn().Err(err).Msg("Failed to initialize push client - push notifications disabled")
|
||||
} else {
|
||||
@@ -57,7 +63,7 @@ func main() {
|
||||
// Initialize email service (optional)
|
||||
var emailService *services.EmailService
|
||||
if cfg.Email.Host != "" {
|
||||
emailService = services.NewEmailService(&cfg.Email)
|
||||
emailService = services.NewEmailService(&cfg.Email, cfg.Features.EmailEnabled)
|
||||
log.Info().Str("host", cfg.Email.Host).Msg("Email service initialized")
|
||||
}
|
||||
|
||||
@@ -109,6 +115,12 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// Check worker kill switch
|
||||
if !cfg.Features.WorkerEnabled {
|
||||
log.Warn().Msg("Worker disabled by FEATURE_WORKER_ENABLED=false, exiting")
|
||||
return
|
||||
}
|
||||
|
||||
// Create Asynq server
|
||||
srv := asynq.NewServer(
|
||||
redisOpt,
|
||||
|
||||
Reference in New Issue
Block a user