diff --git a/mira/base.py b/mira/base.py index 477d939..80b8774 100644 --- a/mira/base.py +++ b/mira/base.py @@ -41,10 +41,18 @@ class MiraBot: self._config = toml.load(config_path) self._jid = aioxmpp.JID.fromstr(self._config["jid"]) - self._password = self._config["password"] self._avatar = self._config.get("avatar", None) self._client = None + # Also supports situations where the secret cannot be in the config file + if "password" in self._config: + self._password = self._config["password"] + else if "password_file" in self._config: + with open(self._config["password_file"], "r") as f: + self._password = f.read() + else: + raise Exception("Neither password nor password_file specified") + self._modules = {} # Module name -> module self._storage_manager = StorageManager.get_instance( self._config.get("storage_path", "/etc/mira/storage.json")