Skip to content

Commit

Permalink
Add an option to allow users to choose to what IP address the web ser…
Browse files Browse the repository at this point in the history
…ver must bind to. Default to 0.0.0.0 (all IP addresses). (#826)
  • Loading branch information
plumbeo authored and mistercrunch committed Jul 28, 2016
1 parent 29e3dd4 commit 8872677
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions caravel/bin/caravel
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ manager.add_command('db', MigrateCommand)
@manager.option(
'-d', '--debug', action='store_true',
help="Start the web server in debug mode")
@manager.option(
'-a', '--address', default=config.get("CARAVEL_WEBSERVER_ADDRESS"),
help="Specify the address to which to bind the web server")
@manager.option(
'-p', '--port', default=config.get("CARAVEL_WEBSERVER_PORT"),
help="Specify the port on which to run the web server")
Expand All @@ -33,7 +36,7 @@ manager.add_command('db', MigrateCommand)
@manager.option(
'-t', '--timeout', default=config.get("CARAVEL_WEBSERVER_TIMEOUT"),
help="Specify the timeout (seconds) for the gunicorn web server")
def runserver(debug, port, timeout, workers):
def runserver(debug, address, port, timeout, workers):
"""Starts a Caravel web server"""
debug = debug or config.get("DEBUG")
if debug:
Expand All @@ -46,7 +49,7 @@ def runserver(debug, port, timeout, workers):
"gunicorn "
"-w {workers} "
"--timeout {timeout} "
"-b 0.0.0.0:{port} "
"-b {address}:{port} "
"--limit-request-line 0 "
"--limit-request-field_size 0 "
"caravel:app").format(**locals())
Expand Down
1 change: 1 addition & 0 deletions caravel/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
ROW_LIMIT = 50000
CARAVEL_WORKERS = 16

CARAVEL_WEBSERVER_ADDRESS = '0.0.0.0'
CARAVEL_WEBSERVER_PORT = 8088
CARAVEL_WEBSERVER_TIMEOUT = 60

Expand Down

0 comments on commit 8872677

Please sign in to comment.