diff options
author | Olivier Wilkinson (reivilibre) <oliverw@matrix.org> | 2023-11-16 16:07:29 +0000 |
---|---|---|
committer | Olivier Wilkinson (reivilibre) <oliverw@matrix.org> | 2023-11-17 12:03:56 +0000 |
commit | 321d3590feb533504337edfbd1905b9382de34a7 (patch) | |
tree | 93a19f5c7e252f093a72af31da8eadd67d885377 | |
parent | Promote mark_filepath to constant (diff) | |
download | synapse-321d3590feb533504337edfbd1905b9382de34a7.tar.xz |
Add a --generate-only option
-rwxr-xr-x | docker/configure_workers_and_start.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/docker/configure_workers_and_start.py b/docker/configure_workers_and_start.py index 8fd1193501..f936a71cc3 100755 --- a/docker/configure_workers_and_start.py +++ b/docker/configure_workers_and_start.py @@ -53,6 +53,7 @@ import platform import re import subprocess import sys +from argparse import ArgumentParser from collections import defaultdict from dataclasses import dataclass, field from itertools import chain @@ -968,6 +969,14 @@ def generate_worker_log_config( def main(args: List[str], environ: MutableMapping[str, str]) -> None: + parser = ArgumentParser() + parser.add_argument( + "--generate-only", + action="store_true", + help="Only generate configuration; don't run Synapse.", + ) + opts = parser.parse_args(args) + config_dir = environ.get("SYNAPSE_CONFIG_DIR", "/data") config_path = environ.get("SYNAPSE_CONFIG_PATH", config_dir + "/homeserver.yaml") data_dir = environ.get("SYNAPSE_DATA_DIR", "/data") @@ -1009,6 +1018,10 @@ def main(args: List[str], environ: MutableMapping[str, str]) -> None: else: log("Worker config exists—not regenerating") + if opts.generate_only: + log("--generate-only: won't run Synapse") + return + # Lifted right out of start.py jemallocpath = "/usr/lib/%s-linux-gnu/libjemalloc.so.2" % (platform.machine(),) @@ -1031,4 +1044,4 @@ def main(args: List[str], environ: MutableMapping[str, str]) -> None: if __name__ == "__main__": - main(sys.argv, os.environ) + main(sys.argv[1:], os.environ) |