Browse Source

Load config from $HROCHOBOT_ETC

news
Martin Mareš 2 years ago
parent
commit
af563d8a2c
  1. 5
      bin/hrochobot

5
bin/hrochobot

@ -6,14 +6,15 @@ import os
data.DATA_FOLDER = os.environ.get("HROCHOBOT_DATA", 'data') data.DATA_FOLDER = os.environ.get("HROCHOBOT_DATA", 'data')
LOG_FOLDER = os.environ.get("HROCHOBOT_LOG", '.') LOG_FOLDER = os.environ.get("HROCHOBOT_LOG", '.')
CONFIG_FOLDER = os.environ.get("HROCHOBOT_ETC", '.')
logger = logging.getLogger('hrochobot') logger = logging.getLogger('hrochobot')
logger.setLevel(logging.INFO) logger.setLevel(logging.INFO)
handler = logging.FileHandler(filename=f'{LOG_FOLDER}/hrochobot.log', encoding='utf-8', mode='w') handler = logging.FileHandler(filename=os.path.join(LOG_FOLDER, 'hrochobot.log'), encoding='utf-8', mode='w')
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s')) handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler) logger.addHandler(handler)
CONFIG = data.load_json("config") CONFIG = data.load_json(os.path.join(CONFIG_FOLDER, "config"))
bot = commands.Bot() bot = commands.Bot()

Loading…
Cancel
Save