Fix encryption toggling
This commit is contained in:
parent
cb95ae83c6
commit
6b7224a61e
2 changed files with 9 additions and 6 deletions
|
@ -45,6 +45,13 @@ class Config(object):
|
|||
self.database_filepath = self._get_cfg(["storage", "database_filepath"], required=True)
|
||||
self.store_filepath = self._get_cfg(["storage", "store_filepath"], required=True)
|
||||
|
||||
# Create the store folder if it doesn't exist
|
||||
if not os.path.isdir(self.store_filepath):
|
||||
if not os.path.exists(self.store_filepath):
|
||||
os.mkdir(self.store_filepath)
|
||||
else:
|
||||
raise ConfigError(f"storage.store_filepath '{self.store_filepath}' is not a directory")
|
||||
|
||||
# Matrix bot account setup
|
||||
self.user_id = self._get_cfg(["matrix", "user_id"], required=True)
|
||||
if not re.match("@.*:.*", self.user_id):
|
||||
|
|
8
main.py
8
main.py
|
@ -34,19 +34,15 @@ async def main():
|
|||
max_limit_exceeded=0,
|
||||
max_timeouts=0,
|
||||
store_sync_tokens=True,
|
||||
encryption_enabled=config.enable_encryption,
|
||||
)
|
||||
|
||||
# Initialize the matrix client
|
||||
if config.enable_encryption:
|
||||
store_path = config.store_filepath
|
||||
else:
|
||||
store_path = None
|
||||
|
||||
client = AsyncClient(
|
||||
config.homeserver_url,
|
||||
config.user_id,
|
||||
device_id=config.device_id,
|
||||
store_path=store_path,
|
||||
store_path=config.store_filepath,
|
||||
config=client_config,
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue