summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2019-06-21 10:53:49 +0100
committerRichard van der Hoff <richard@matrix.org>2019-06-24 14:15:34 +0100
commit6a92b06cbb4677a38bf3f5bb3bb22dfbd93ea088 (patch)
tree27e912a61c81f28c41ad2bbaa4ae315f5ba8c660
parentchangelog (diff)
downloadsynapse-6a92b06cbb4677a38bf3f5bb3bb22dfbd93ea088.tar.xz
Add --data-directory commandline argument
We don't necessarily want to put the data in the cwd.
-rw-r--r--synapse/config/_base.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/synapse/config/_base.py b/synapse/config/_base.py
index 8757416a60..8654b0f4a1 100644
--- a/synapse/config/_base.py
+++ b/synapse/config/_base.py
@@ -290,6 +290,15 @@ class Config(object):
                 " config file."
             ),
         )
+        generate_group.add_argument(
+            "--data-directory",
+            metavar="DIRECTORY",
+            help=(
+                "Specify where data such as the media store and database file should be"
+                " stored. Defaults to the current working directory."
+            ),
+        )
+
         config_args, remaining_args = config_parser.parse_known_args(argv)
 
         config_files = find_config_files(search_paths=config_args.config_path)
@@ -323,6 +332,12 @@ class Config(object):
             if not cls.path_exists(config_path):
                 print("Generating config file %s" % (config_path,))
 
+                if config_args.data_directory:
+                    data_dir_path = config_args.data_directory
+                else:
+                    data_dir_path = os.getcwd()
+                data_dir_path = os.path.abspath(data_dir_path)
+
                 server_name = config_args.server_name
                 if not server_name:
                     raise ConfigError(