From 572cc8eb6f70e3acbae57e586788f15e9b562f96 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Fri, 26 Feb 2016 00:16:15 +0100 Subject: browse.py: allow port override via environment variable --- doc/manual.asciidoc | 3 ++- src/browse.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/manual.asciidoc b/doc/manual.asciidoc index 0d842f9..4e69ad4 100644 --- a/doc/manual.asciidoc +++ b/doc/manual.asciidoc @@ -223,7 +223,8 @@ found useful during Ninja's development. The current tools are: `browse`:: browse the dependency graph in a web browser. Clicking a file focuses the view on that file, showing inputs and outputs. This -feature requires a Python installation. +feature requires a Python installation. The `PORT` environment variable +can be used to override the default port number (8000). `graph`:: output a file in the syntax used by `graphviz`, a automatic graph layout tool. Use it like: diff --git a/src/browse.py b/src/browse.py index 9e59bd8..081eb8c 100755 --- a/src/browse.py +++ b/src/browse.py @@ -182,7 +182,7 @@ class RequestHandler(httpserver.BaseHTTPRequestHandler): def log_message(self, format, *args): pass # Swallow console spam. -port = 8000 +port = int(os.getenv("PORT", '8000')) httpd = httpserver.HTTPServer(('',port), RequestHandler) try: hostname = socket.gethostname() -- cgit v0.12