From af7c1397d1ba402bb58482c2204484d23d33a403 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 25 Aug 2015 16:58:01 +0100 Subject: Add config option to specify where generated files should be dumped --- synapse/config/_base.py | 16 ++++++++++++++-- 1 file 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 @@ -144,6 +144,12 @@ class Config(object): action="store_true", 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 = {} -- cgit 1.4.1 From 82145912c330528ec85276467f4ea38362e796b8 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 25 Aug 2015 17:31:22 +0100 Subject: s/--generated-directory/--keys-directory/ --- synapse/config/_base.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/synapse/config/_base.py b/synapse/config/_base.py index 1bc2e61ee6..93433c0756 100644 --- a/synapse/config/_base.py +++ b/synapse/config/_base.py @@ -145,10 +145,10 @@ class Config(object): help="Generate any missing key files then exit" ) config_parser.add_argument( - "--generated-directory", + "--keys-directory", metavar="DIRECTORY", - help="Used with 'generate-*' options to specify where generated" - " files (such as certs and signing keys) should be stored." + help="Used with 'generate-*' options to specify where files such as" + " certs and signing keys should be stored in." ) config_parser.add_argument( "-H", "--server-name", @@ -184,8 +184,8 @@ class Config(object): ) (config_path,) = config_files if not os.path.exists(config_path): - if config_args.generated_directory: - config_dir_path = config_args.generated_directory + 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) @@ -236,8 +236,8 @@ class Config(object): " -c CONFIG-FILE\"" ) - if config_args.generated_directory: - config_dir_path = config_args.generated_directory + 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) -- cgit 1.4.1 From 3f6f74686a564face040bb0b4daf57a3112161e2 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 25 Aug 2015 17:37:21 +0100 Subject: Update config doc --- synapse/config/_base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/synapse/config/_base.py b/synapse/config/_base.py index 93433c0756..e92a6c779a 100644 --- a/synapse/config/_base.py +++ b/synapse/config/_base.py @@ -148,7 +148,8 @@ class Config(object): "--keys-directory", metavar="DIRECTORY", help="Used with 'generate-*' options to specify where files such as" - " certs and signing keys should be stored in." + " certs and signing keys should be stored in, unless explicitly" + " specified in the config." ) config_parser.add_argument( "-H", "--server-name", -- cgit 1.4.1