diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2019-06-24 17:24:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-24 17:24:35 +0100 |
commit | af8a9629057942d4dfa919df90d76d1fdc549606 (patch) | |
tree | f404909096abfe3635a02568f5ff02d79e7126f6 /synapse/config/key.py | |
parent | Merge pull request #5499 from matrix-org/rav/cleanup_metrics (diff) | |
parent | changelog (diff) | |
download | synapse-af8a9629057942d4dfa919df90d76d1fdc549606.tar.xz |
Merge pull request #5523 from matrix-org/rav/arg_defaults
Stop conflating generated config and default config
Diffstat (limited to 'synapse/config/key.py')
-rw-r--r-- | synapse/config/key.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/synapse/config/key.py b/synapse/config/key.py index e58638f708..8fc74f9cdf 100644 --- a/synapse/config/key.py +++ b/synapse/config/key.py @@ -65,13 +65,18 @@ class TrustedKeyServer(object): class KeyConfig(Config): - def read_config(self, config, **kwargs): + def read_config(self, config, config_dir_path, **kwargs): # the signing key can be specified inline or in a separate file if "signing_key" in config: self.signing_key = read_signing_keys([config["signing_key"]]) else: - self.signing_key_path = config["signing_key_path"] - self.signing_key = self.read_signing_key(self.signing_key_path) + signing_key_path = config.get("signing_key_path") + if signing_key_path is None: + signing_key_path = os.path.join( + config_dir_path, config["server_name"] + ".signing.key" + ) + + self.signing_key = self.read_signing_key(signing_key_path) self.old_signing_keys = self.read_old_signing_keys( config.get("old_signing_keys", {}) @@ -117,7 +122,7 @@ class KeyConfig(Config): # falsification of values self.form_secret = config.get("form_secret", None) - def default_config( + def generate_config_section( self, config_dir_path, server_name, generate_secrets=False, **kwargs ): base_key_name = os.path.join(config_dir_path, server_name) @@ -237,8 +242,15 @@ class KeyConfig(Config): ) return keys - def generate_files(self, config): - signing_key_path = config["signing_key_path"] + def generate_files(self, config, config_dir_path): + if "signing_key" in config: + return + + signing_key_path = config.get("signing_key_path") + if signing_key_path is None: + signing_key_path = os.path.join( + config_dir_path, config["server_name"] + ".signing.key" + ) if not self.path_exists(signing_key_path): print("Generating signing key file %s" % (signing_key_path,)) |