mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
fixed issue where server settings don't get reloaded when changing server config without restarting crafty. Now server settings get repulled from DB after writing new settings on config change
This commit is contained in:
parent
9e6ba7ba03
commit
10bd7a74c9
@ -87,6 +87,10 @@ class Controller:
|
||||
s['auto_start_delay']
|
||||
))
|
||||
|
||||
def refresh_server_settings(self, server_id: int):
|
||||
server_obj = self.get_server_obj(server_id)
|
||||
server_obj.reload_server_settings()
|
||||
|
||||
def get_server_obj(self, server_id):
|
||||
|
||||
for s in self.servers_list:
|
||||
|
@ -13,7 +13,7 @@ import logging.config
|
||||
|
||||
from app.classes.shared.helpers import helper
|
||||
from app.classes.shared.console import console
|
||||
|
||||
from app.classes.shared.models import db_helper, Servers
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -45,6 +45,10 @@ class Server:
|
||||
self.is_crashed = False
|
||||
self.restart_count = 0
|
||||
|
||||
def reload_server_settings(self):
|
||||
server_data = db_helper.get_server_data_by_id(self.server_id)
|
||||
self.settings = server_data
|
||||
|
||||
def do_server_setup(self, server_data_obj):
|
||||
logger.info('Creating Server object: {} | Server Name: {} | Auto Start: {}'.format(
|
||||
server_data_obj['server_id'],
|
||||
|
@ -161,6 +161,8 @@ class PanelHandler(BaseHandler):
|
||||
Servers.crash_detection: crash_detection,
|
||||
}).where(Servers.server_id == server_id).execute()
|
||||
|
||||
controller.refresh_server_settings(server_id)
|
||||
|
||||
user_data = json.loads(self.get_secure_cookie("user_data"))
|
||||
|
||||
db_helper.add_to_audit_log(user_data['user_id'],
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"last_refreshed": "09/21/2020, 21:59:31",
|
||||
"last_refreshed": "10/07/2020, 09:09:10",
|
||||
"servers": {
|
||||
"nukkitx": [
|
||||
"1.14"
|
||||
|
Loading…
Reference in New Issue
Block a user