From 6a5e679aecfc37ff17794ebbf816480da25b1e73 Mon Sep 17 00:00:00 2001
From: mcinj <98779161+mcinj@users.noreply.github.com>
Date: Fri, 20 May 2022 23:42:42 -0400
Subject: [PATCH] fix ref
---
src/bot/templates/configuration.html | 3 ++-
src/bot/templates/log.html | 3 ++-
src/bot/webserver_thread.py | 15 +++++++++++----
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/bot/templates/configuration.html b/src/bot/templates/configuration.html
index db2c119..7268e62 100644
--- a/src/bot/templates/configuration.html
+++ b/src/bot/templates/configuration.html
@@ -11,7 +11,8 @@
diff --git a/src/bot/templates/log.html b/src/bot/templates/log.html
index 80b7b71..9b486de 100644
--- a/src/bot/templates/log.html
+++ b/src/bot/templates/log.html
@@ -11,7 +11,8 @@
diff --git a/src/bot/webserver_thread.py b/src/bot/webserver_thread.py
index c62ebf0..6f6aeba 100644
--- a/src/bot/webserver_thread.py
+++ b/src/bot/webserver_thread.py
@@ -1,3 +1,4 @@
+import os
import threading
from threading import Thread
@@ -38,13 +39,19 @@ class WebServerThread(threading.Thread):
@app.route(f"{self.app_root}")
def config():
- with open('../config/config.ini', 'r') as f:
+ with open(f"{os.getenv('BOT_CONFIG_DIR', './config')}/config.ini", 'r') as f:
content = f.read()
return render_template('configuration.html', content=content)
- @app.route(f"{self.app_root}log")
- def logs():
- with open('../config/info.log', 'r') as f:
+ @app.route(f"{self.app_root}log_info")
+ def log_info():
+ with open(f"{os.getenv('BOT_CONFIG_DIR', './config')}/info.log", 'r') as f:
+ content = f.read()
+ return render_template('log.html', content=content)
+
+ @app.route(f"{self.app_root}log_debug")
+ def log_debug():
+ with open(f"{os.getenv('BOT_CONFIG_DIR', './config')}/debug.log", 'r') as f:
content = f.read()
return render_template('log.html', content=content)