Author: justi9
Date: 2008-03-19 11:01:21 -0400 (Wed, 19 Mar 2008)
New Revision: 1777
Modified:
mgmt/cumin/bin/cumin
mgmt/cumin/python/wooly/server.py
Log:
bz437791 - Bind to localhost by default, and provide a parameter in
the cumin cli to bind to a different address.
Also, change the default port to 8080 in anticipation of running cumin
as a non-priveleged user by default.
Modified: mgmt/cumin/bin/cumin
===================================================================
--- mgmt/cumin/bin/cumin 2008-03-19 14:10:48 UTC (rev 1776)
+++ mgmt/cumin/bin/cumin 2008-03-19 15:01:21 UTC (rev 1777)
@@ -11,13 +11,14 @@
-h, --help Print this message
--data URL Connect to database at URL
(default postgesql://cumin@localhost/cumin)
- --port PORT Run web server on port PORT (default 80)
- --ssl yes Serve pages using SSL
+ --addr ADDR Run web server at address ADDR (default localhost)
+ --port PORT Run web server on port PORT (default 8080)
+ --ssl yes Serve pages using SSL (default no)
--debug Enable debugging"""
sys.exit(1)
-def do_main(home, data, spec, port, ssl, debug):
+def do_main(home, data, spec, addr, port, ssl, debug):
app = Cumin(home, data, spec)
if debug:
@@ -33,8 +34,7 @@
app.init()
- host = socket.gethostname()
- server = CuminServer(app, host, port)
+ server = CuminServer(app, addr, port)
if ssl:
cpath = os.path.join(home, "etc", "cumin.crt")
@@ -72,7 +72,8 @@
config.add_param("home", "s", home)
config.add_param("data", "s",
"postgresql://cumin@localhost/cumin")
config.add_param("spec", "s", spec)
- config.add_param("port", "i", 80)
+ config.add_param("addr", "s", "localhost")
+ config.add_param("port", "i", 8080)
config.add_param("ssl", "b", False)
config.add_param("debug", "b", False)
@@ -85,11 +86,12 @@
home = config.get("home")
data = config.get("data")
spec = config.get("spec")
+ addr = config.get("addr")
port = config.get("port")
ssl = config.get("ssl")
debug = config.get("debug")
- do_main(home, data, spec, port, ssl, debug)
+ do_main(home, data, spec, addr, port, ssl, debug)
if __name__ == "__main__":
try:
Modified: mgmt/cumin/python/wooly/server.py
===================================================================
--- mgmt/cumin/python/wooly/server.py 2008-03-19 14:10:48 UTC (rev 1776)
+++ mgmt/cumin/python/wooly/server.py 2008-03-19 15:01:21 UTC (rev 1777)
@@ -10,14 +10,14 @@
class WebServer(object):
http_date = "%a, %d %b %Y %H:%M:%S %Z"
- def __init__(self, app, host, port):
+ def __init__(self, app, addr, port):
self.app = app
- self.host = host
+ self.addr = addr
self.port = port
- addr = (self.host, self.port)
+ fqaddr = (self.addr, self.port)
apps = [("", self.service)]
- self.__server = CherryPyWSGIServer(addr, apps)
+ self.__server = CherryPyWSGIServer(fqaddr, apps)
def set_ssl_cert_path(self, path):
self.__server.ssl_certificate = path