diff options
author | Jorik Schellekens <joriks@matrix.org> | 2019-08-28 16:31:12 +0100 |
---|---|---|
committer | Jorik Schellekens <joriks@matrix.org> | 2019-08-28 16:31:12 +0100 |
commit | b1c9c5a078f29c1d5086dfb00658ee60342cbfb1 (patch) | |
tree | c75a0f1a9b29ceec6a2f19d82f0a2e52a4e4f2fd | |
parent | Extra support for configuring postgres (diff) | |
download | synapse-b1c9c5a078f29c1d5086dfb00658ee60342cbfb1.tar.xz |
Fix config in use check
-rw-r--r-- | synapse_topology/model/__init__.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/synapse_topology/model/__init__.py b/synapse_topology/model/__init__.py index db679d5777..4a3f28c71e 100644 --- a/synapse_topology/model/__init__.py +++ b/synapse_topology/model/__init__.py @@ -11,7 +11,7 @@ from .errors import BaseConfigInUseError, ConfigNotFoundError, ServernameNotSetE from .config import create_config from .util import is_subpath -# from synapse.config import find_config_files, read_config_files +from synapse.config import find_config_files class Model: @@ -73,14 +73,18 @@ class Model: it's not present we assume someone else has set up synapse before so we assume the config is in use. """ - try: - pass - # return read_config_files(find_config_files(self.config_dir)).get( - # CONFIG_LOCK, True - # ) - except FileNotFoundError: + config = {} + config_files = find_config_files([self.config_dir]) + for config_file in config_files: + with open(config_file) as stream: + config.update(yaml.safe_load(stream)) + + if not config: return False + print(config.get(CONFIG_LOCK)) + return config.get(CONFIG_LOCK, True) + def generate_secret_key(self, server_name): if self.config_in_use(): raise BaseConfigInUseError() |