diff options
author | Erik Johnston <erik@matrix.org> | 2019-03-14 13:32:14 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-03-14 13:32:14 +0000 |
commit | 9ad448c1e56dc548d8ee22494deabe802637b58a (patch) | |
tree | 8ede79d5b49432315a81a27821af90d3bff1ee6d /synapse/config/workers.py | |
parent | Newsfile (diff) | |
download | synapse-9ad448c1e56dc548d8ee22494deabe802637b58a.tar.xz |
Correctly handle all command line options
Diffstat (limited to 'synapse/config/workers.py')
-rw-r--r-- | synapse/config/workers.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/synapse/config/workers.py b/synapse/config/workers.py index 8dc013d0e8..bfbd8b6c91 100644 --- a/synapse/config/workers.py +++ b/synapse/config/workers.py @@ -28,7 +28,7 @@ class WorkerConfig(Config): if self.worker_app == "synapse.app.homeserver": self.worker_app = None - self.worker_listeners = config.get("worker_listeners") + self.worker_listeners = config.get("worker_listeners", []) self.worker_daemonize = config.get("worker_daemonize") self.worker_pid_file = config.get("worker_pid_file") self.worker_log_file = config.get("worker_log_file") @@ -48,6 +48,17 @@ class WorkerConfig(Config): self.worker_main_http_uri = config.get("worker_main_http_uri", None) self.worker_cpu_affinity = config.get("worker_cpu_affinity") + # This option is really only here to support `--manhole` command line + # argument. + manhole = config.get("worker_manhole") + if manhole: + self.worker_listeners.append({ + "port": manhole, + "bind_addresses": ["127.0.0.1"], + "type": "manhole", + "tls": False, + }) + if self.worker_listeners: for listener in self.worker_listeners: bind_address = listener.pop("bind_address", None) @@ -59,5 +70,16 @@ class WorkerConfig(Config): bind_addresses.append('') def read_arguments(self, args): + # We support a bunch of command line arguments that override options in + # the config. A lot of these options have a worker_* prefix when running + # on workers so we also have to override them when command line options + # are specified. + if args.daemonize is not None: self.worker_daemonize = args.daemonize + if args.log_config is not None: + self.worker_log_config = args.log_config + if args.log_file is not None: + self.worker_log_file = args.log_file + if args.manhole is not None: + self.worker_manhole = args.worker_manhole |