From 6a92b06cbb4677a38bf3f5bb3bb22dfbd93ea088 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 21 Jun 2019 10:53:49 +0100 Subject: [PATCH] Add --data-directory commandline argument We don't necessarily want to put the data in the cwd. --- synapse/config/_base.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/synapse/config/_base.py b/synapse/config/_base.py index 8757416a6..8654b0f4a 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(