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:
Trey t
2025-11-29 12:04:31 -06:00
parent c4118c8186
commit a15e847098
15 changed files with 649 additions and 257 deletions

View File

@@ -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)