version: '3.3'

networks:
  public-network:
    driver: bridge

volumes:
  mongo_data:
  redis_data:

services:
  api:
    container_name: codechat_api
    image: codechat/api:v1.2.8
    restart: unless-stopped
    ports:
      - 8083:8083
    volumes:
      - ./instances:/codechat/instances
      - ./src/env.yml:/codechat/src/env.yml:ro
    # environment:
    #   - DOCKER_ENV=true
    #   - LOG_LEVEL='ERROR,WARN,DEBUG,INFO,LOG,VERBOSE,DARK'
    #   - LOG_COLOR=true

    #   - DEL_INSTANCE=5

    #   - STORE_CLEANING_INTERVAL=7200 
    #   - STORE_MESSAGE=true
    #   - STORE_CONTACTS=false
    #   - STORE_CHATS=false

    #   - DATABASE_ENABLED=false
    #   - DATABASE_CONNECTION_URI='mongodb://<USER>:<PASSWORD>@<HOST>/?authSource=admin&readPreference=primary&ssl=false&directConnection=true'
    #   - DATABASE_CONNECTION_DB_PREFIX_NAME='codechat'
    #   - DATABASE_SAVE_DATA_INSTANCE=false
    #   - DATABASE_SAVE_DATA_OLD_MESSAGE=false
    #   - DATABASE_SAVE_DATA_NEW_MESSAGE=true
    #   - DATABASE_SAVE_MESSAGE_UPDATE=true
    #   - DATABASE_SAVE_DATA_CONTACTS=true
    #   - DATABASE_SAVE_DATA_CHATS=true

    #   - REDIS_ENABLED=false
    #   - REDIS_URI='redis://<HOST>/1'
    #   - REDIS_PREFIX_KEY='codechat'

    #   - WEBHOOK_GLOBAL_URL='<url>'
    #   - WEBHOOK_GLOBAL_ENABLED=false
    #   - WEBHOOK_EVENTS_STATUS_INSTANCE=true
    #   - WEBHOOK_EVENTS_QRCODE_UPDATED=true
    #   - WEBHOOK_EVENTS_MESSAGES_SET=true
    #   - WEBHOOK_EVENTS_MESSAGES_UPDATE=true
    #   - WEBHOOK_EVENTS_MESSAGES_UPSERT=true
    #   - WEBHOOK_EVENTS_SEND_MESSAGE=true
    #   - WEBHOOK_EVENTS_CONTACTS_SET=true
    #   - WEBHOOK_EVENTS_CONTACTS_UPSERT=true
    #   - WEBHOOK_EVENTS_CONTACTS_UPDATE=true
    #   - WEBHOOK_EVENTS_PRESENCE_UPDATE=true
    #   - WEBHOOK_EVENTS_CHATS_SET=true
    #   - WEBHOOK_EVENTS_CHATS_UPSERT=true
    #   - WEBHOOK_EVENTS_CHATS_UPDATE=true
    #   - WEBHOOK_EVENTS_CONNECTION_UPDATE=true
    #   - WEBHOOK_EVENTS_GROUPS_UPSERT=false
    #   - WEBHOOK_EVENTS_GROUPS_UPDATE=false
    #   - WEBHOOK_EVENTS_GROUP_PARTICIPANTS_UPDATE=false
    #   - WEBHOOK_EVENTS_NEW_JWT_TOKEN=false

    #   - CONFIG_SESSION_PHONE_CLIENT='CodeChat'
    #   - CONFIG_SESSION_PHONE_NAME='Chrome'

    #   - QRCODE_LIMIT=6

    #   - AUTHENTICATION_TYPE='jwt'
    #   - AUTHENTICATION_API_KEY='t8OOEeISKzpmc3jjcMqBWYSaJsafdefer'
    #   - AUTHENTICATION_JWT_EXPIRIN_IN=0
    #   - AUTHENTICATION_JWT_SECRET='3RFYiiRmvNiokSBrLZzx'
    command: ['node', './src/main.js']
    networks:
      - public-network

  # mongodb:
  #   container_name: mongodb
  #   image: mongo:6
  #   restart: unless-stopped
  #   volumes:
  #     - mongo_data:/data/db
  #   environment:
  #     MONGO_INITDB_ROOT_USERNAME: root
  #     MONGO_INITDB_ROOT_PASSWORD: mysupersecretpassword
  #   networks:
  #     - public-network

  # cache:
  #   image: redis:7
  #   restart: unless-stopped
  #   command: redis-server --save 20 1 --loglevel warning 
  #   volumes: 
  #     - redis_data:/data
  #   networks:
  #     - public-network
