Commit b201e1d9 authored by nanahira's avatar nanahira

would not start if invalid config

parent 5f49702a
......@@ -160,10 +160,15 @@ setting_change = global.setting_change = (settings, path, val, callback) ->
# 读取配置
default_config = loadJSON('./data/default_config.json')
try
config = loadJSON('./config/config.json')
catch
if fs.existsSync('./config/config.json')
try
config = loadJSON('./config/config.json')
catch e
console.error("Failed reading config: ", e.toString())
process.exit(1)
else
config = {}
settings = global.settings = merge(default_config, config, { arrayMerge: (destination, source) -> source })
auth = global.auth = require './ygopro-auth.js'
......
......@@ -174,9 +174,15 @@
// 读取配置
default_config = loadJSON('./data/default_config.json');
try {
config = loadJSON('./config/config.json');
} catch (error1) {
if (fs.existsSync('./config/config.json')) {
try {
config = loadJSON('./config/config.json');
} catch (error1) {
e = error1;
console.error("Failed reading config: ", e.toString());
process.exit(1);
}
} else {
config = {};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment