[#1908] [WebUI] Add bind interface option for server
This commit is contained in:
parent
9eb6b7c52a
commit
49d4bb4969
|
@ -80,6 +80,7 @@ CONFIG_DEFAULTS = {
|
|||
|
||||
# Server Settings
|
||||
"base": "/",
|
||||
"interface": "0.0.0.0",
|
||||
"port": 8112,
|
||||
"https": False,
|
||||
"pkey": "ssl/daemon.pkey",
|
||||
|
@ -607,6 +608,7 @@ class DelugeWeb(component.Component):
|
|||
self.socket = None
|
||||
self.top_level = TopLevel()
|
||||
self.site = server.Site(self.top_level)
|
||||
self.interface = self.config["interface"]
|
||||
self.port = self.config["port"]
|
||||
self.https = self.config["https"]
|
||||
self.pkey = self.config["pkey"]
|
||||
|
@ -649,15 +651,13 @@ class DelugeWeb(component.Component):
|
|||
reactor.run()
|
||||
|
||||
def start_normal(self):
|
||||
self.socket = reactor.listenTCP(self.port, self.site)
|
||||
log.info("serving on %s:%s view at http://127.0.0.1:%s", "0.0.0.0",
|
||||
self.port, self.port)
|
||||
self.socket = reactor.listenTCP(self.port, self.site, interface=self.interface)
|
||||
log.info("serving on %s:%s view at http://%s:%s", self.interface, self.port, self.interface, self.port)
|
||||
|
||||
def start_ssl(self):
|
||||
check_ssl_keys()
|
||||
self.socket = reactor.listenSSL(self.port, self.site, ServerContextFactory())
|
||||
log.info("serving on %s:%s view at https://127.0.0.1:%s", "0.0.0.0",
|
||||
self.port, self.port)
|
||||
self.socket = reactor.listenSSL(self.port, self.site, ServerContextFactory(), interface=self.interface)
|
||||
log.info("serving on %s:%s view at https://%s:%s", self.interface, self.port, self.interface, self.port)
|
||||
|
||||
def stop(self):
|
||||
log.info("Shutting down webserver")
|
||||
|
|
|
@ -70,6 +70,9 @@ class Web(_UI):
|
|||
group.add_option("-g", "--group", dest="group", type="str",
|
||||
help="Group to switch to. Only use it when starting as root",
|
||||
action="store", default=None)
|
||||
group.add_option("-i", "--interface", dest="interface",
|
||||
type="str", help="Binds the webserver to a specific IP address",
|
||||
action="store", default=None)
|
||||
group.add_option("-p", "--port", dest="port", type="int",
|
||||
help="Sets the port to be used for the webserver",
|
||||
action="store", default=None)
|
||||
|
@ -134,6 +137,9 @@ class Web(_UI):
|
|||
if self.options.base:
|
||||
self.server.base = self.options.base
|
||||
|
||||
if self.options.interface:
|
||||
self.server.interface = self.options.interface
|
||||
|
||||
if self.options.port:
|
||||
self.server.port = self.options.port
|
||||
|
||||
|
|
|
@ -22,6 +22,9 @@ Set the base path that the ui is running on (proxying)
|
|||
.B -f, --fork
|
||||
Fork the web interface process into the background
|
||||
.TP
|
||||
.B -i INTERFACE, --interface=INTERFACE
|
||||
Binds the webserver to a specific IP address
|
||||
.TP
|
||||
.B -p PORT, --port=PORT
|
||||
Sets the port to be used for the webserver
|
||||
.TP
|
||||
|
|
Loading…
Reference in New Issue