35 lines
917 B
Python
35 lines
917 B
Python
import os
|
|
|
|
import pymongo
|
|
from loguru import logger
|
|
|
|
logger.add('log.log', format="{time} {level} {name}:{line} {message}", level="INFO",
|
|
rotation="100 MB", retention='7 days',
|
|
enqueue=True)
|
|
|
|
|
|
class Config:
|
|
kafka_setting = {
|
|
'sasl_plain_username': 'legu666666',
|
|
'sasl_plain_password': '5EINbjyI',
|
|
'bootstrap_servers': ["39.104.71.242:9093", "39.104.71.78:9093", "39.104.67.122:9093"],
|
|
'topic_name': os.environ.get('topic_name').split(','),
|
|
'consumer_id': os.environ.get('consumer_id')
|
|
}
|
|
|
|
local_mongo_uri = os.environ["local_mongo_uri"]
|
|
mdb_clint = pymongo.MongoClient(local_mongo_uri)
|
|
mydb = mdb_clint["admin_game"]
|
|
admin_game_coll = mydb['game']
|
|
|
|
|
|
class Production(Config):
|
|
DB_PREFIX = 'game'
|
|
|
|
|
|
class Debug(Config):
|
|
DB_PREFIX = 'debug'
|
|
|
|
|
|
settings = Production if os.environ.get('xlegudata_env') == 'production' else Debug
|