- Add TestMode, RateLimitEnabled, RequestsPerMinute to Config - Add getEnvBool() and getEnvInt() helper functions - Update rate limiter to support enabled/disabled state - Pass test environment variables through docker-compose - Configure rate limiter dynamically in main.go This allows disabling rate limiting for integration testing while maintaining security in production environments.
57 lines
1.3 KiB
YAML
57 lines
1.3 KiB
YAML
version: "3.8"
|
|
|
|
services:
|
|
db:
|
|
image: postgres:15-alpine
|
|
container_name: bookmann_db
|
|
environment:
|
|
POSTGRES_DB: bookmann
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: ${DBPASS}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./database/schema:/docker-entrypoint-initdb.d
|
|
ports:
|
|
- "5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
env_file:
|
|
- .env
|
|
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: ./Dockerfile
|
|
container_name: bookmann
|
|
environment:
|
|
DATABASE_HOST: db
|
|
DATABASE_PORT: 5432
|
|
DATABASE_USER: postgres
|
|
DATABASE_PASSWORD: ${DBPASS}
|
|
DATABASE_NAME: bookmann
|
|
JWT_SECRET: ${JWT_SECRET}
|
|
SERVER_PORT: 8765
|
|
TEST_MODE: ${TEST_MODE:-false}
|
|
RATE_LIMIT_ENABLED: ${RATE_LIMIT_ENABLED:-true}
|
|
REQUESTS_PER_MINUTE: ${REQUESTS_PER_MINUTE:-10}
|
|
ports:
|
|
- "8765:8765"
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ./uploads:/app/uploads
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8765/"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
env_file:
|
|
- .env
|
|
|
|
volumes:
|
|
postgres_data:
|