summary refs log tree commit diff
path: root/synapse/config/_base.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-08-25 16:58:01 +0100
committerErik Johnston <erik@matrix.org>2015-08-25 16:58:01 +0100
commitaf7c1397d1ba402bb58482c2204484d23d33a403 (patch)
tree81dc37c093e0f4c81bd94c43d3a36e2a11e32347 /synapse/config/_base.py
parentAllow specifying directories as config files (diff)
downloadsynapse-af7c1397d1ba402bb58482c2204484d23d33a403.tar.xz
Add config option to specify where generated files should be dumped
Diffstat (limited to '')
-rw-r--r--synapse/config/_base.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/synapse/config/_base.py b/synapse/config/_base.py
index fd5080a3cb..1bc2e61ee6 100644
--- a/synapse/config/_base.py
+++ b/synapse/config/_base.py
@@ -145,6 +145,12 @@ class Config(object):
             help="Generate any missing key files then exit"
         )
         config_parser.add_argument(
+            "--generated-directory",
+            metavar="DIRECTORY",
+            help="Used with 'generate-*' options to specify where generated"
+                 " files (such as certs and signing keys) should be stored."
+        )
+        config_parser.add_argument(
             "-H", "--server-name",
             help="The server name to generate a config file for"
         )
@@ -178,7 +184,10 @@ class Config(object):
                 )
             (config_path,) = config_files
             if not os.path.exists(config_path):
-                config_dir_path = os.path.dirname(config_path)
+                if config_args.generated_directory:
+                    config_dir_path = config_args.generated_directory
+                else:
+                    config_dir_path = os.path.dirname(config_path)
                 config_dir_path = os.path.abspath(config_dir_path)
 
                 server_name = config_args.server_name
@@ -227,7 +236,10 @@ class Config(object):
                 " -c CONFIG-FILE\""
             )
 
-        config_dir_path = os.path.dirname(config_args.config_path[-1])
+        if config_args.generated_directory:
+            config_dir_path = config_args.generated_directory
+        else:
+            config_dir_path = os.path.dirname(config_args.config_path[-1])
         config_dir_path = os.path.abspath(config_dir_path)
 
         specified_config = {}