summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-08-25 17:40:19 +0100
committerErik Johnston <erik@matrix.org>2015-08-25 17:40:19 +0100
commit0de2aad0613eb13fb2b08965daad59451c3c16ed (patch)
treeb57a0bfc524c9b55eac29d99624a77d4abb2ecf5
parentMerge pull request #249 from matrix-org/erikj/allow_config_path_dirs (diff)
parentUpdate config doc (diff)
downloadsynapse-0de2aad0613eb13fb2b08965daad59451c3c16ed.tar.xz
Merge pull request #250 from matrix-org/erikj/generated_directory
Add config option to specify where generated files should be dumped
-rw-r--r--synapse/config/_base.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/synapse/config/_base.py b/synapse/config/_base.py
index 2f218d4a7b..d01235d31f 100644
--- a/synapse/config/_base.py
+++ b/synapse/config/_base.py
@@ -145,6 +145,13 @@ class Config(object):
             help="Generate any missing key files then exit"
         )
         config_parser.add_argument(
+            "--keys-directory",
+            metavar="DIRECTORY",
+            help="Used with 'generate-*' options to specify where files such as"
+                 " certs and signing keys should be stored in, unless explicitly"
+                 " specified in the config."
+        )
+        config_parser.add_argument(
             "-H", "--server-name",
             help="The server name to generate a config file for"
         )
@@ -188,7 +195,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.keys_directory:
+                    config_dir_path = config_args.keys_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
@@ -237,7 +247,10 @@ class Config(object):
                 " -c CONFIG-FILE\""
             )
 
-        config_dir_path = os.path.dirname(config_args.config_path[-1])
+        if config_args.keys_directory:
+            config_dir_path = config_args.keys_directory
+        else:
+            config_dir_path = os.path.dirname(config_args.config_path[-1])
         config_dir_path = os.path.abspath(config_dir_path)
 
         specified_config = {}