Paths #240
@ -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();
|
||||
|
Reference in New Issue
Block a user