From 56a742b3c68063f9fa94fe683e1810b5504bffee Mon Sep 17 00:00:00 2001 From: Matheus Sampaio Queiroga Date: Tue, 16 Nov 2021 00:45:23 -0300 Subject: [PATCH] Push --- lib/BdsSettings.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/BdsSettings.js b/lib/BdsSettings.js index 1300513..c77bf4d 100644 --- a/lib/BdsSettings.js +++ b/lib/BdsSettings.js @@ -102,13 +102,18 @@ var Config = { } // Config -const ConfigPath = join(resolve(homedir(), "bds_core"), "BdsConfig.yaml") +const ConfigPath = join(bds_dir, "BdsConfig.yaml") const SaveConfig = () => writeFileSync(ConfigPath, yaml.dump(Config)); process.on("exit", () => SaveConfig()); -if (existsSync(ConfigPath)) Config = deepmerge(Config, yaml.load(readFileSync(ConfigPath, "utf8"))); -else writeFileSync(ConfigPath, yaml.dump(Config)) +if (existsSync(ConfigPath)) { + Config.ban = []; + Config.server.BackupCron = []; + Config.telegram.admins = []; + Config.telegram.ban = []; + Config = deepmerge(Config, yaml.load(readFileSync(ConfigPath, "utf8"))); +} else writeFileSync(ConfigPath, yaml.dump(Config)) // Paths if (!(existsSync(Config.paths["backups"]))) mkdirSync(Config.paths["backups"], {recursive: true}) @@ -123,6 +128,7 @@ const ServersPaths = { dragonfly: join(Config.paths.servers, "Dragonfly_go"), spigot: join(Config.paths.servers, "Spigot") } + Object.getOwnPropertyNames(ServersPaths).map(Servers => ServersPaths[Servers]).forEach(Servers => { if (!(existsSync(Servers))) { console.log(`Creating the ${basename(Servers)} Folder`); @@ -200,7 +206,7 @@ const GetTempHost = () => Config.bds.enable_tmp_host function UpdateTempHost(enable = false){ // Check Boolean if (typeof enable !== "boolean") {console.log("Use Boolean, default false"); enable = false;} - + // Save Config.bds.enable_tmp_host = enable SaveConfig(); -- 2.49.0