Merge branch 'pr/93' into Migrate-to-SQLite

This commit is contained in:
Donald Cheng Hong Zou
2022-01-13 09:44:47 -05:00
5 changed files with 129 additions and 22 deletions

View File

@@ -1670,13 +1670,37 @@ def check_update():
return result
"""
Configure DashBoard before start web-server
"""
def run_dashboard():
init_dashboard()
global update
update = check_update()
global config
config = configparser.ConfigParser(strict=False)
config.read('wg-dashboard.ini')
global app_ip
app_ip = config.get("Server", "app_ip")
global app_port
app_port = config.get("Server", "app_port")
global wg_conf_path
wg_conf_path = config.get("Server", "wg_conf_path")
config.clear()
return app
"""
Get host and port for web-server
"""
def get_host_bind():
init_dashboard()
config = configparser.ConfigParser(strict=False)
config.read('wg-dashboard.ini')
app_ip = config.get("Server", "app_ip")
app_port = config.get("Server", "app_port")
return app_ip, app_port
if __name__ == "__main__":
init_dashboard()
UPDATE = check_update()
configuration_settings = get_dashboard_conf()
app_ip = configuration_settings.get("Server", "app_ip")
app_port = int(configuration_settings.get("Server", "app_port"))
WG_CONF_PATH = configuration_settings.get("Server", "wg_conf_path")
configuration_settings.clear()
run_dashboard()
app.run(host=app_ip, debug=False, port=app_port)