forked from snxraven/LinkUp-P2P-Chat
Very strange stuff tbh
This commit is contained in:
parent
f6f804ab39
commit
f3b4755821
10
app.js
10
app.js
@ -97,7 +97,7 @@ async function initialize() {
|
||||
|
||||
const configExists = fs.existsSync("./config.json");
|
||||
if (configExists) {
|
||||
await readConfigFromFile("./config.json");
|
||||
config = JSON.parse(fs.readFileSync("./config.json", 'utf8'));
|
||||
console.log("Read config from file:", config)
|
||||
config.rooms.forEach(room => {
|
||||
addRoomToList(room);
|
||||
@ -429,12 +429,4 @@ function writeConfigToFile(filePath) {
|
||||
});
|
||||
}
|
||||
|
||||
async function readConfigFromFile(filePath) {
|
||||
await fs.readFile(filePath, 'utf8', (err, data) => {
|
||||
if(err) return console.log("Error while reading config.json! ", err)
|
||||
data = JSON.parse(data);
|
||||
config = data;
|
||||
});
|
||||
}
|
||||
|
||||
initialize();
|
||||
|
Loading…
Reference in New Issue
Block a user