diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2019-03-04 17:14:58 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-04 17:14:58 +0000 |
commit | 8e28bc5eeecbc2c9130c05e8c8237a546fb4d3ea (patch) | |
tree | b6257afed4b8d90441ee285d425f910e7b5e9060 /synapse/config/_base.py | |
parent | Fix v4v6 option in HAProxy example config (#4790) (diff) | |
download | synapse-8e28bc5eeecbc2c9130c05e8c8237a546fb4d3ea.tar.xz |
Include a default configuration file in the 'docs' directory. (#4791)
Diffstat (limited to 'synapse/config/_base.py')
-rw-r--r-- | synapse/config/_base.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/synapse/config/_base.py b/synapse/config/_base.py index 5aec43b702..c4d3087fa4 100644 --- a/synapse/config/_base.py +++ b/synapse/config/_base.py @@ -180,9 +180,7 @@ class Config(object): Returns: str: the yaml config file """ - default_config = "# vim:ft=yaml\n" - - default_config += "\n\n".join( + default_config = "\n\n".join( dedent(conf) for conf in self.invoke_all( "default_config", @@ -297,19 +295,26 @@ class Config(object): "Must specify a server_name to a generate config for." " Pass -H server.name." ) + + config_str = obj.generate_config( + config_dir_path=config_dir_path, + data_dir_path=os.getcwd(), + server_name=server_name, + report_stats=(config_args.report_stats == "yes"), + generate_secrets=True, + ) + if not cls.path_exists(config_dir_path): os.makedirs(config_dir_path) with open(config_path, "w") as config_file: - config_str = obj.generate_config( - config_dir_path=config_dir_path, - data_dir_path=os.getcwd(), - server_name=server_name, - report_stats=(config_args.report_stats == "yes"), - generate_secrets=True, + config_file.write( + "# vim:ft=yaml\n\n" ) - config = yaml.load(config_str) - obj.invoke_all("generate_files", config) config_file.write(config_str) + + config = yaml.load(config_str) + obj.invoke_all("generate_files", config) + print( ( "A config file has been generated in %r for server name" |