From 92d1b6d6da3a2e523ca8b1e30f7827b10b5f652f Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Sun, 20 Nov 2016 13:30:28 -0800 Subject: [PATCH] run-dev: Fix regression ignoring --interface argument. When we migrated run-dev.py from Twisted to Tornado a few weeks ago, the --interface argument wasn't properly ported and thus was ignored. This restores the original functionality of defaulting to only listening on localhost. Ideally, we'd replace the vagrant/zulipdev user check with something that just checks whether a special file that is created by the Vagrant/remote-dev-vm creation process exists; that would be more robust. --- tools/run-dev.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/run-dev.py b/tools/run-dev.py index e23f22effd..2339635873 100755 --- a/tools/run-dev.py +++ b/tools/run-dev.py @@ -73,14 +73,18 @@ if not options.force: if options.interface is None: user_id = os.getuid() user_name = pwd.getpwuid(user_id).pw_name - if user_name == "vagrant": + if user_name in ["vagrant", "zulipdev"]: # In the Vagrant development environment, we need to listen on # all ports, and it's safe to do so, because Vagrant is only - # exposing certain guest ports (by default just 9991) to the host. - options.interface = "" + # exposing certain guest ports (by default just 9991) to the + # host. The same argument applies to the remote development + # servers using username "zulipdev". + options.interface = None else: # Otherwise, only listen to requests on localhost for security. options.interface = "127.0.0.1" +elif options.interface == "": + options.interface = None base_port = 9991 if options.test: @@ -360,7 +364,7 @@ print("".join((WARNING, try: app = Application() - app.listen(proxy_port) + app.listen(proxy_port, address=options.interface) ioloop = IOLoop.instance() for s in (signal.SIGINT, signal.SIGTERM): signal.signal(s, shutdown_handler)