diff --git a/xmpp_discord_bridge/main.py b/xmpp_discord_bridge/main.py index 0942749..bb7f7fc 100644 --- a/xmpp_discord_bridge/main.py +++ b/xmpp_discord_bridge/main.py @@ -489,21 +489,26 @@ class BridgeComponent(ComponentXMPP): asyncio.ensure_future(self._discord.start(self._token)) def main(): - if os.path.exists("./config.toml"): + parser = OptionParser() + parser.add_option( + "-d", "--debug", dest="debug", help="Enable debug logging", action="store_true" + ) + parser.add_option( + "-c", "--config", dest="config", help="Config file path" + ) + + (options, args) = parser.parse_args() + verbosity = logging.DEBUG if options.debug else logging.INFO + + if options.config: + config = toml.load(options.config) + elif os.path.exists("./config.toml"): config = toml.load("./config.toml") elif os.path.exists("/etc/discord-xmpp-bridge/config.toml"): config = toml.load("/etc/discord-xmpp-bridge/config.toml") else: raise Exception("config.toml not found") - parser = OptionParser() - parser.add_option( - "-d", "--debug", dest="debug", help="Enable debug logging", action="store_true" - ) - - (options, args) = parser.parse_args() - verbosity = logging.DEBUG if options.debug else logging.INFO - general = config["general"] xmpp = BridgeComponent(general["jid"], general["secret"],