Skip to content

Commit

Permalink
run-dev.py: Fix incorrectly printed hostname for droplets.
Browse files Browse the repository at this point in the history
Because the logic in print_listeners doesn't have access to computed
settings in dev_settings.py, we need to duplicate the special
IS_DEV_DROPLET logic for computing the default hostname.

There's still a secondary problem that this URL 404s.
  • Loading branch information
timabbott committed Apr 6, 2021
1 parent 3c41db7 commit e51344a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tools/run-dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,14 @@ def shutdown_handler(*args: Any, **kwargs: Any) -> None:


def print_listeners() -> None:
external_host = os.getenv("EXTERNAL_HOST", f"localhost:{proxy_port}")
# Since we can't import settings from here, we duplicate some
# EXTERNAL_HOST logic from dev_settings.py.
IS_DEV_DROPLET = pwd.getpwuid(os.getuid()).pw_name == "zulipdev"
if IS_DEV_DROPLET:
default_hostname = os.uname()[1].lower()
else:
default_hostname = "localhost"
external_host = os.getenv("EXTERNAL_HOST", f"{default_hostname}:{proxy_port}")
print(f"\nStarting Zulip on:\n\n\t{CYAN}http://{external_host}/{ENDC}\n\nInternal ports:")
ports = [
(proxy_port, "Development server proxy (connect here)"),
Expand Down
1 change: 1 addition & 0 deletions zproject/dev_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
if external_host_env is None:
if IS_DEV_DROPLET:
# For our droplets, we use the hostname (eg github_username.zulipdev.org) by default.
# Note that this code is duplicated in run-dev.py.
EXTERNAL_HOST = os.uname()[1].lower() + ":9991"
else:
# For local development environments, we use localhost by
Expand Down

0 comments on commit e51344a

Please sign in to comment.