Load security config

This commit is contained in:
Vortrex
2023-03-04 08:35:06 -06:00
parent 6b3651f660
commit 72ae8aeead

View File

@@ -178,12 +178,12 @@ let gameConfig = false;
let globalConfig = { let globalConfig = {
keyBind: [], keyBind: [],
economy: {},
database: {}, database: {},
locale: {}, locale: {},
accents: {}, accents: {},
discord: {}, discord: {},
email: {}, email: {},
security: {},
accountPasswordHash: "SHA512", accountPasswordHash: "SHA512",
npcFarProximity: 100, npcFarProximity: 100,
npcMediumProximity: 40, npcMediumProximity: 40,
@@ -333,6 +333,13 @@ function loadGlobalConfig() {
thisResource.stop(); thisResource.stop();
} }
try {
getGlobalConfig().security = loadSecurityConfig();
} catch (error) {
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load security configuration. Error: ${error}`);
thisResource.stop();
}
logToConsole(LOG_DEBUG, "[V.RP.Config] Loaded global configuration successfully!"); logToConsole(LOG_DEBUG, "[V.RP.Config] Loaded global configuration successfully!");
} }
@@ -1075,6 +1082,17 @@ function loadEmailConfig() {
// =========================================================================== // ===========================================================================
function loadSecurityConfig() {
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading security configuration ...");
let securityConfig = JSON.parse(loadTextFile("config/security.json"));
if (securityConfig != null) {
return securityConfig;
}
return false;
}
// ===========================================================================
function doesServerHaveGUIEnabled() { function doesServerHaveGUIEnabled() {
return getServerConfig().useGUI; return getServerConfig().useGUI;
} }