mirror of
https://github.com/towalink/wgfrontend.git
synced 2025-04-19 00:45:15 +00:00
Allow specifying bind interface and listening port in config file
This commit is contained in:
parent
e51938b617
commit
8a66b40750
@ -53,6 +53,12 @@ class Configuration():
|
||||
# The command to be executed when the WireGuard config has changed
|
||||
# on_change_command =
|
||||
# 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
|
||||
user = {user}
|
||||
@ -111,6 +117,16 @@ class Configuration():
|
||||
"""The command to be executed on config changes"""
|
||||
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
|
||||
def user(self):
|
||||
"""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):
|
||||
# Use ssl/tls if certificate files are present
|
||||
cherrypy.server.ssl_module = 'builtin'
|
||||
cherrypy.server.ssl_certificate = cfg.sslcertfile
|
||||
cherrypy.server.ssl_private_key = cfg.sslkeyfile
|
||||
cherrypy.config.update({'server.socket_host': '0.0.0.0',
|
||||
'server.socket_port': 8080,
|
||||
cherrypy.config.update({'server.socket_host': cfg.socket_host,
|
||||
'server.socket_port': cfg.socket_port,
|
||||
})
|
||||
cherrypy.tree.mount(app, config=app_conf)
|
||||
if setupenv.is_root():
|
||||
|
Loading…
x
Reference in New Issue
Block a user