From 6955216568c9db4cdb49d9771f333632010d5364 Mon Sep 17 00:00:00 2001 From: nihonium Date: Sat, 6 Dec 2025 05:24:29 +0300 Subject: [PATCH] feat(cicd): added redis --- deploy/docker-compose.yml | 25 +++++++++++++++++++++---- modules/auth/handlers/handlers.go | 1 + 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml index 1119335..3eff3d3 100644 --- a/deploy/docker-compose.yml +++ b/deploy/docker-compose.yml @@ -40,6 +40,22 @@ services: retries: 5 start_period: 10s + redis: + image: redis:8.4.0-alpine + container_name: redis + ports: + - "6379:6379" + restart: always + command: ["redis-server", "--appendonly", "yes"] + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 5s + volumes: + - redis_data:/data + nyanimedb-backend: image: meowgit.nekoea.red/nihonium/nyanimedb-backend:latest container_name: nyanimedb-backend @@ -51,8 +67,8 @@ services: RABBITMQ_URL: ${RABBITMQ_URL} JWT_PRIVATE_KEY: ${JWT_PRIVATE_KEY} AUTH_ENABLED: ${AUTH_ENABLED} - ports: - - "8080:8080" + # ports: + # - "8080:8080" depends_on: - postgres - rabbitmq @@ -68,8 +84,8 @@ services: DATABASE_URL: ${DATABASE_URL} SERVICE_ADDRESS: ${SERVICE_ADDRESS} JWT_PRIVATE_KEY: ${JWT_PRIVATE_KEY} - ports: - - "8082:8082" + # ports: + # - "8082:8082" depends_on: - postgres networks: @@ -89,6 +105,7 @@ services: volumes: postgres_data: rabbitmq_data: + redis_data: networks: nyanimedb-network: diff --git a/modules/auth/handlers/handlers.go b/modules/auth/handlers/handlers.go index 2a6518e..3af44f3 100644 --- a/modules/auth/handlers/handlers.go +++ b/modules/auth/handlers/handlers.go @@ -199,6 +199,7 @@ func (s Server) GetImpersonationToken(ctx context.Context, req auth.GetImpersona } if req.Body.UserId != nil { + // TODO: check user existence if user_id != "" && user_id != fmt.Sprintf("%d", *req.Body.UserId) { log.Error("user_id and external_d are incorrect") // TODO: 405