Replace Gorush with direct APNs/FCM integration
- Add direct APNs client using sideshow/apns2 for iOS push - Add direct FCM client using legacy HTTP API for Android push - Remove Gorush dependency (no external push server needed) - Update all services/handlers to use new push.Client - Update config for APNS_PRODUCTION flag 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
"github.com/treytartt/casera-api/internal/config"
|
||||
"github.com/treytartt/casera-api/internal/database"
|
||||
"github.com/treytartt/casera-api/internal/push"
|
||||
"github.com/treytartt/casera-api/internal/router"
|
||||
"github.com/treytartt/casera-api/internal/services"
|
||||
"github.com/treytartt/casera-api/pkg/utils"
|
||||
@@ -110,6 +111,18 @@ func main() {
|
||||
pdfService := services.NewPDFService()
|
||||
log.Info().Msg("PDF service initialized")
|
||||
|
||||
// Initialize push notification client (APNs + FCM)
|
||||
var pushClient *push.Client
|
||||
pushClient, err = push.NewClient(&cfg.Push)
|
||||
if err != nil {
|
||||
log.Warn().Err(err).Msg("Failed to initialize push client - push notifications disabled")
|
||||
} else {
|
||||
log.Info().
|
||||
Bool("ios_enabled", pushClient.IsIOSEnabled()).
|
||||
Bool("android_enabled", pushClient.IsAndroidEnabled()).
|
||||
Msg("Push notification client initialized")
|
||||
}
|
||||
|
||||
// Setup router with dependencies (includes admin panel at /admin)
|
||||
deps := &router.Dependencies{
|
||||
DB: db,
|
||||
@@ -117,6 +130,7 @@ func main() {
|
||||
Config: cfg,
|
||||
EmailService: emailService,
|
||||
PDFService: pdfService,
|
||||
PushClient: pushClient,
|
||||
StorageService: storageService,
|
||||
}
|
||||
r := router.SetupRouter(deps)
|
||||
|
||||
@@ -39,11 +39,16 @@ func main() {
|
||||
sqlDB, _ := db.DB()
|
||||
defer sqlDB.Close()
|
||||
|
||||
// Initialize push client (optional)
|
||||
var gorushClient *push.GorushClient
|
||||
if cfg.Push.GorushURL != "" {
|
||||
gorushClient = push.NewGorushClient(&cfg.Push)
|
||||
log.Info().Str("url", cfg.Push.GorushURL).Msg("Gorush client initialized")
|
||||
// Initialize push client (APNs + FCM)
|
||||
var pushClient *push.Client
|
||||
pushClient, err = push.NewClient(&cfg.Push)
|
||||
if err != nil {
|
||||
log.Warn().Err(err).Msg("Failed to initialize push client - push notifications disabled")
|
||||
} else {
|
||||
log.Info().
|
||||
Bool("ios_enabled", pushClient.IsIOSEnabled()).
|
||||
Bool("android_enabled", pushClient.IsAndroidEnabled()).
|
||||
Msg("Push notification client initialized")
|
||||
}
|
||||
|
||||
// Initialize email service (optional)
|
||||
@@ -80,7 +85,7 @@ func main() {
|
||||
)
|
||||
|
||||
// Create job handler
|
||||
jobHandler := jobs.NewHandler(db, gorushClient, emailService, cfg)
|
||||
jobHandler := jobs.NewHandler(db, pushClient, emailService, cfg)
|
||||
|
||||
// Create Asynq mux and register handlers
|
||||
mux := asynq.NewServeMux()
|
||||
|
||||
Reference in New Issue
Block a user