add redis cache to competitions

This commit is contained in:
Timur Kh.
2025-12-17 12:24:07 +03:00
parent 8ded3cc6ab
commit 6a9376505d
5 changed files with 91 additions and 9 deletions
+8
View File
@@ -21,6 +21,10 @@ type Config struct {
DBPassword string
DBName string
JWTSecret string
RedisAddr string
RedisPassword string
RedisDB int
CacheEnabled bool
}
func Load() (*Config, error) {
@@ -37,6 +41,10 @@ func Load() (*Config, error) {
DBPassword: getEnv("POSTGRES_PASSWORD", "postgres"),
DBName: getEnv("POSTGRES_DATABASE", "postgres"),
JWTSecret: getEnv("JWT_SECRET", "your-secret-key-change-in-production"),
RedisAddr: getEnv("REDIS_ADDR", "localhost:6379"),
RedisPassword: getEnv("REDIS_PASSWORD", ""),
RedisDB: mustGetInt("REDIS_DB", 0),
CacheEnabled: mustGetBool("CACHE_ENABLED", true),
}, nil
}