feat: migrate to DragonflyDB and clean up environment configuration

- Replace Redis with DragonflyDB for better performance and memory efficiency
- Remove redundant environment variables (POSTGRES_*, ENCRYPTION_KEY, OAUTH_SERVICE_URL)
- Consolidate database configuration to use single DB_* variables
- Use JWT_SECRET for both JWT tokens and encryption
- Remove PORT variable redundancy, use BACKEND_PORT consistently
- Clean up docker-compose configurations for dev/prod consistency
- Add DragonflyDB configuration with optimized memory usage
- Remove redis.conf as it's no longer needed
- Update health checks to use Redis-compatible CLI for DragonflyDB
- Add missing VITE_API_URL to production frontend
- Fix GitHub Actions to use correct go.sum path
- Clean up development directories and unused files
This commit is contained in:
Tomas Dvorak
2026-03-05 23:51:34 +01:00
parent f3a835caa2
commit 954a1a1080
146 changed files with 5801 additions and 25847 deletions
+11 -4
View File
@@ -149,7 +149,7 @@ func main() {
// }()
// Set Gin mode
if os.Getenv("GIN_MODE") == "release" {
if os.Getenv("GIN_MODE") == "release" || os.Getenv("GIN_MODE") == "production" {
gin.SetMode(gin.ReleaseMode)
}
@@ -159,6 +159,7 @@ func main() {
// Middleware
r.Use(gin.Logger())
r.Use(gin.Recovery())
r.Use(middleware.CORSMiddleware())
r.Use(middleware.CacheMiddleware(cacheConfig)) // Add DragonflyDB cache middleware
r.Use(middleware.CacheInvalidationMiddleware(dragonflyClient)) // Add cache invalidation
r.Use(middleware.SessionMiddleware()) // Add session middleware
@@ -172,8 +173,6 @@ func main() {
// Apply general rate limiting to all endpoints
r.Use(middleware.GeneralRateLimit(rateLimiters["general"]))
r.Use(middleware.CORSMiddleware())
r.GET("/health", handlers.HealthCheck)
r.GET("/ready", handlers.ReadinessCheck)
r.GET("/live", handlers.LivenessCheck)
@@ -231,7 +230,7 @@ func main() {
auth.POST("/login", handlers.Login)
auth.POST("/login-totp", handlers.LoginWithTOTP)
auth.POST("/logout", handlers.Logout)
auth.GET("/me", handlers.GetCurrentUserWithGitHub)
auth.GET("/me", handlers.AuthMiddleware(), handlers.GetCurrentUserWithGitHub)
auth.POST("/password-reset", handlers.RequestPasswordReset)
auth.POST("/password-reset/confirm", handlers.ConfirmPasswordReset)
@@ -241,11 +240,19 @@ func main() {
auth.GET("/oauth/callback", handlers.HandleOAuthCallback)
}
// GitHub App callback (public for GitHub redirect)
v1.GET("/github/app/callback", handlers.GitHubAppInstallCallback)
// GitHub routes (protected)
github := v1.Group("/github")
github.Use(handlers.AuthMiddleware())
{
github.GET("/repos", handlers.GetGitHubRepos)
github.GET("/app/status", handlers.GetGitHubAppStatus)
github.GET("/app/install-url", handlers.GetGitHubAppInstallURL)
github.GET("/app/repos", handlers.GetGitHubAppRepos)
github.GET("/backups", handlers.GetGitHubBackups)
github.POST("/backups", handlers.BackupGitHubRepositories)
}
v1.POST("/youtube-search-test", handlers.YouTubeSearchTest)