main: Accept the config file from the cli
This commit is contained in:
parent
40fcd404a4
commit
8ab23c63ab
@ -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"],
|
||||
|
Loading…
Reference in New Issue
Block a user