import json


class Config:
    # ck数据库连接
    CK_CONFIG = {'host': '139.159.159.3',
                 'port': 9654,
                 }

    # 每个游戏不一样 游戏上报 kafka 主题
    SUBSCRIBE_TOPIC = 'shanhai'

    KAFKA_CONSUMER_CONF = {
        'bootstrap_servers': ["192.168.0.30:9092", "192.168.0.71:9092", "192.168.0.229:9092"],
        'value_deserializer': json.loads,
        'auto_offset_reset': 'earliest',
        'enable_auto_commit': True,
        'auto_commit_interval_ms': 10000,

        # 每个游戏不一样
        'group_id': 'shanhai_group'
    }
    KAFKA_PRODUCER_CONF = {
        'bootstrap_servers': ["192.168.0.30:9092", "192.168.0.71:9092", "192.168.0.229:9092"],
        'value_serializer': lambda v: json.dumps(v).encode('utf-8'),
    }
    # 游戏数据库名
    GAME = 'shanhai'

    STOP_SIGNAL = 'stop_MntxuXMc'

    REDIS_CONF = {
        'host': '192.168.0.161',
        'port': 6379,
        'password': 'd1Gh*zp5',
        'db': 1,  # 存表结构
        'decode_responses': True
    }


class Debug(Config):
    pass


settings = Debug
