fix: Make the configuration file location configurable

This commit is contained in:
PapaTutuWawa 2021-06-12 21:02:17 +02:00
parent e9900ee9b6
commit f4bc27add5

View File

@ -131,12 +131,15 @@ def main():
parser = OptionParser() parser = OptionParser()
parser.add_option('-d', '--debug', dest='debug', parser.add_option('-d', '--debug', dest='debug',
help='Enable debug logging', action='store_true') help='Enable debug logging', action='store_true')
parser.add_option('-c', '--config', dest='config', help='Location of the config.toml',
default='/etc/mira/storage.json')
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
verbosity = logging.DEBUG if options.debug else logging.INFO verbosity = logging.DEBUG if options.debug else logging.INFO
logging.basicConfig(stream=sys.stdout, level=verbosity) logging.basicConfig(stream=sys.stdout, level=verbosity)
bot = MiraBot("./config.toml") logging.info('Loading config from %s' % (options.config))
bot = MiraBot(options.config)
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
loop.run_until_complete(bot.connect()) loop.run_until_complete(bot.connect())