summary refs log tree commit diff
diff options
context:
space:
mode:
authorJorik Schellekens <joriks@matrix.org>2019-08-28 16:59:48 +0100
committerJorik Schellekens <joriks@matrix.org>2019-08-28 16:59:48 +0100
commitd56e1bedadc2135c61cd24ccc95fbb53602cf223 (patch)
tree27477c28e363689bc44d707592a79650a9e68ee2
parentFix config in use check (diff)
downloadsynapse-d56e1bedadc2135c61cd24ccc95fbb53602cf223.tar.xz
Generate extra files needed for startup like the config file.
-rw-r--r--synapse_topology/model/config.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/synapse_topology/model/config.py b/synapse_topology/model/config.py
index f5ac8b61ca..278c3bbdb5 100644
--- a/synapse_topology/model/config.py
+++ b/synapse_topology/model/config.py
@@ -1,5 +1,7 @@
 from os.path import join
 
+import yaml
+
 from synapse.config.database import DatabaseConfig
 from synapse.config.homeserver import HomeServerConfig
 from synapse.config.logger import LoggingConfig
@@ -32,7 +34,7 @@ def create_config(config_dir_path, data_dir_path, conf):
     class BaseConfig(*base_configs):
         pass
 
-    class Configs(*uninitialized_configs):
+    class AdvancedConfig(*uninitialized_configs):
         pass
 
     config_args = {
@@ -43,12 +45,21 @@ def create_config(config_dir_path, data_dir_path, conf):
         "database_conf": database_conf,
     }
 
-    base_config = BaseConfig().generate_config(**config_args)
+    base_config = BaseConfig()
+    advanced_config = AdvancedConfig()
+
+    base_config_text = base_config.generate_config(**config_args)
+    advanced_config_text = advanced_config.generate_config(**config_args)
+
+    config = {}
+    config.update(yaml.safe_load(base_config_text))
+    config.update(yaml.safe_load(advanced_config_text))
 
-    rest_of_config = Configs().generate_config(**config_args)
+    base_config.generate_missing_files(config, config_dir_path)
+    advanced_config.generate_missing_files(config, config_dir_path)
 
     return {
-        "homeserver.yaml": base_config
+        "homeserver_basic_config.yaml": base_config_text
         + "\n\nserver_config_in_use: {}".format(server_config_in_use),
-        "the_rest.yaml": rest_of_config,
+        "homeserver_advanced_config.yaml": advanced_config_text,
     }