mirror of
https://github.com/towalink/wgfrontend.git
synced 2025-04-19 08:55:11 +00:00
Allow specifying bind interface and listening port in config file
This commit is contained in:
parent
e51938b617
commit
8a66b40750
@ -54,6 +54,12 @@ class Configuration():
|
|||||||
# on_change_command =
|
# on_change_command =
|
||||||
# Example: on_change_command = "sudo /etc/init.d/wgfrontend_interface restart"
|
# Example: on_change_command = "sudo /etc/init.d/wgfrontend_interface restart"
|
||||||
|
|
||||||
|
# The interface to bind to for the web server
|
||||||
|
# socket_host = 0.0.0.0
|
||||||
|
|
||||||
|
# The port to bind to for the web server
|
||||||
|
# socket_port = 8080
|
||||||
|
|
||||||
# The system user to be used for the frontend
|
# The system user to be used for the frontend
|
||||||
user = {user}
|
user = {user}
|
||||||
|
|
||||||
@ -111,6 +117,16 @@ class Configuration():
|
|||||||
"""The command to be executed on config changes"""
|
"""The command to be executed on config changes"""
|
||||||
return self.config.get('on_change_command')
|
return self.config.get('on_change_command')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def socket_host(self):
|
||||||
|
"""The interface to bind to"""
|
||||||
|
return self.config.get('socket_host', '0.0.0.0')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def socket_port(self):
|
||||||
|
"""The port to bind to"""
|
||||||
|
return int(self.config.get('socket_port', 8080))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def user(self):
|
def user(self):
|
||||||
"""The configured name for the wgfrontend system user"""
|
"""The configured name for the wgfrontend system user"""
|
||||||
|
@ -128,11 +128,12 @@ def run_webapp(cfg):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if os.path.exists(cfg.sslcertfile) and os.path.exists(cfg.sslkeyfile):
|
if os.path.exists(cfg.sslcertfile) and os.path.exists(cfg.sslkeyfile):
|
||||||
|
# Use ssl/tls if certificate files are present
|
||||||
cherrypy.server.ssl_module = 'builtin'
|
cherrypy.server.ssl_module = 'builtin'
|
||||||
cherrypy.server.ssl_certificate = cfg.sslcertfile
|
cherrypy.server.ssl_certificate = cfg.sslcertfile
|
||||||
cherrypy.server.ssl_private_key = cfg.sslkeyfile
|
cherrypy.server.ssl_private_key = cfg.sslkeyfile
|
||||||
cherrypy.config.update({'server.socket_host': '0.0.0.0',
|
cherrypy.config.update({'server.socket_host': cfg.socket_host,
|
||||||
'server.socket_port': 8080,
|
'server.socket_port': cfg.socket_port,
|
||||||
})
|
})
|
||||||
cherrypy.tree.mount(app, config=app_conf)
|
cherrypy.tree.mount(app, config=app_conf)
|
||||||
if setupenv.is_root():
|
if setupenv.is_root():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user