services:
  mrwho-oidc:
    depends_on:
      mrwho-postgres:
        condition: service_healthy
      mrwho-redis:
        condition: service_healthy

    environment:
      Redis__Enabled: ${REDIS_ENABLED:-true}
      Redis__ConnectionString: ${REDIS_CONNECTION_STRING:-mrwho-redis:6379,abortConnect=false}
      Redis__Database: ${REDIS_DATABASE:-0}
      Redis__InstanceName: ${REDIS_INSTANCE_NAME:-mrwho}

  mrwho-redis:
    image: redis:7.2-alpine
    container_name: mrwho-redis
    command: redis-server --save 60 1 --loglevel warning --maxmemory 512mb --maxmemory-policy allkeys-lru

    volumes:
      - redis-data:/data

    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 3s
      retries: 5
      start_period: 5s

    restart: unless-stopped

    networks:
      - internal

volumes:
  redis-data:
    driver: local
