version: '3.8'

networks:
  public-network:
    driver: bridge

services:
  api:
    container_name: codechat_api
    image: codechat/api:latest
    restart: unless-stopped
    ports:
      - 8084:8084
    volumes:
      - instances_connecteds:/codechat/instances
    environment:
      - SERVER_PORT=8084
      - SESSION_SECRET=W0NvZGVDaGF0XTpbU2Vzc

      - LOG_LEVEL=ERROR|WARN|INFO|DEBUG|LOG|VERBOSE|DARK
      - LOG_COLOR=true

      - DATABASE_ENABLED=true
      - DATABASE_URL=postgres://postgres:VP6rbVUoNZFfNAuSKj8xusy5pG2ZKhRebo0D0HiNEf0@worker.codechat.dev/codechat_api_v1?schema=public
      - DATABASE_SYNC_MESSAGES=true
      - DATABASE_SAVE_DATA_NEW_MESSAGE=true
      - DATABASE_SAVE_MESSAGE_UPDATE=true
      - DATABASE_SAVE_DATA_CONTACTS=true
      - DATABASE_SAVE_DATA_CHATS=true

      - GLOBAL_WEBHOOK_URL=url
      - GLOBAL_WEBHOOK_ENABLED=false

      - INSTANCE_EXPIRATION_TIME=false

      - CONFIG_SESSION_PHONE_CLIENT=CodeChat_V1
      - CONFIG_SESSION_PHONE_NAME=Edge

      - QRCODE_LIMIT=10
      - QRCODE_EXPIRATION_TIME=60

      - CONNECTION_TIMEOUT=300

      - AUTHENTICATION_GLOBAL_AUTH_TOKEN=zYzP7ocstxh3SJ23D4FZTCu4ehnM8v4hu
      - AUTHENTICATION_JWT_EXPIRES_IN=0
      - AUTHENTICATION_JWT_SECRET=3RFYiiRmvNiokSBrLZzx

      - REDIS_ENABLED=false
      - REDIS_URI=redis://[HOST]/5
      - REDIS_PREFIX=codechat

      - S3_ENABLED=false
      - S3_ACCESS_KEY=[ACCESS_KEY]
      - S3_SECRET_KEY=[SECRET_KEY]
      - S3_BUCKET=[BUCKET]
      - S3_PORT=9000
      - S3_ENDPOINT=[ENDPOINT]
      - S3_USE_SSL=false
    networks:
      - public-network
  
  # redis_cache:
  #   image: redis:latest
  #   container_name: redis_cache
  #   volumes:
  #     - redis_data:/data
  #   ports:
  #     - "6379:6379"
  #   networks:
  #     - public_network

volumes:
  instances_connecteds:
    driver: local
  redis_data:
    driver: local
