summaryrefslogtreecommitdiffstats
path: root/glances/outputs/glances_restful_api.py
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2024-04-26 09:28:40 +0200
committernicolargo <nicolas@nicolargo.com>2024-04-26 09:28:40 +0200
commit11245a793a7bc39119ecbd0c18c9c27f4d057ed5 (patch)
treeb33226cb0c59f9d4263d5fabc8619a7334130f52 /glances/outputs/glances_restful_api.py
parentf2b232ebaf3ac735b3a130df9dc7e6856f0a6942 (diff)
parentdf66a7ffe9bf3b7cb8eebd10f234a3ab01f6ac0c (diff)
Merge branch 'issue2612' into develop
Diffstat (limited to 'glances/outputs/glances_restful_api.py')
-rw-r--r--glances/outputs/glances_restful_api.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/glances/outputs/glances_restful_api.py b/glances/outputs/glances_restful_api.py
index 35935c77..178a52f0 100644
--- a/glances/outputs/glances_restful_api.py
+++ b/glances/outputs/glances_restful_api.py
@@ -2,7 +2,7 @@
#
# This file is part of Glances.
#
-# SPDX-FileCopyrightText: 2023 Nicolas Hennion <nicolas@nicolargo.com>
+# SPDX-FileCopyrightText: 2024 Nicolas Hennion <nicolas@nicolargo.com>
#
# SPDX-License-Identifier: LGPL-3.0-only
#
@@ -14,7 +14,6 @@ import sys
import tempfile
from io import open
import webbrowser
-import socket
from urllib.parse import urljoin
# Replace typing_extensions by typing when Python 3.8 support will be dropped
@@ -115,8 +114,13 @@ class GlancesRestfulApi(object):
self._app.include_router(APIRouter(prefix=self.url_prefix.rstrip('/')))
# Set path for WebUI
- self.STATIC_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'static/public')
- self.TEMPLATE_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'static/templates')
+ webui_root_path = config.get_value('outputs',
+ 'webui_root_path',
+ default=os.path.dirname(os.path.realpath(__file__)))
+ if webui_root_path == '':
+ webui_root_path = os.path.dirname(os.path.realpath(__file__))
+ self.STATIC_PATH = os.path.join(webui_root_path, 'static/public')
+ self.TEMPLATE_PATH = os.path.join(webui_root_path, 'static/templates')
self._templates = Jinja2Templates(directory=self.TEMPLATE_PATH)
# FastAPI Enable CORS