Working on Config system (Saving & Loading user data) #3

Merged
snxraven merged 16 commits from MiTask/LinkUp-P2P-Chat:main into main 2024-06-09 03:11:48 -04:00
Showing only changes of commit f6f804ab39 - Show all commits

8
app.js
View File

@ -431,13 +431,9 @@ function writeConfigToFile(filePath) {
async function readConfigFromFile(filePath) { async function readConfigFromFile(filePath) {
await fs.readFile(filePath, 'utf8', (err, data) => { await fs.readFile(filePath, 'utf8', (err, data) => {
if(err) return console.log("Error while reading config.json! ", err); if(err) return console.log("Error while reading config.json! ", err)
console.log("1:", data);
data = JSON.parse(data); data = JSON.parse(data);
console.log("2:", data); config = data;
config.userName = data.userName;
config.userAvatar = data.userAvatar;
config.rooms = data.rooms;
}); });
} }