Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 26e674f

Browse files
committed
Add a --generate-only option
1 parent 48f98f0 commit 26e674f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docker/configure_workers_and_start.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import re
5454
import subprocess
5555
import sys
56+
from argparse import ArgumentParser
5657
from collections import defaultdict
5758
from dataclasses import dataclass, field
5859
from itertools import chain
@@ -969,6 +970,14 @@ def generate_worker_log_config(
969970

970971

971972
def main(args: List[str], environ: MutableMapping[str, str]) -> None:
973+
parser = ArgumentParser()
974+
parser.add_argument(
975+
"--generate-only",
976+
action="store_true",
977+
help="Only generate configuration; don't run Synapse.",
978+
)
979+
opts = parser.parse_args(args)
980+
972981
config_dir = environ.get("SYNAPSE_CONFIG_DIR", "/data")
973982
config_path = environ.get("SYNAPSE_CONFIG_PATH", config_dir + "/homeserver.yaml")
974983
data_dir = environ.get("SYNAPSE_DATA_DIR", "/data")
@@ -1010,6 +1019,10 @@ def main(args: List[str], environ: MutableMapping[str, str]) -> None:
10101019
else:
10111020
log("Worker config exists—not regenerating")
10121021

1022+
if opts.generate_only:
1023+
log("--generate-only: won't run Synapse")
1024+
return
1025+
10131026
# Lifted right out of start.py
10141027
jemallocpath = "/usr/lib/%s-linux-gnu/libjemalloc.so.2" % (platform.machine(),)
10151028

0 commit comments

Comments
 (0)