mattermost-desktop/src/browser/config/AppConfig.js

23 lines
479 B
JavaScript
Raw Normal View History

2016-12-25 07:44:44 -08:00
const settings = require('../../common/settings');
const {remote} = require('electron');
2016-12-25 08:03:35 -08:00
class AppConfig {
constructor(file) {
this.fileName = file;
try {
this.data = settings.readFileSync(file);
} catch (e) {
this.data = {
teams: []
};
}
}
set(key, value) {
this.data[key] = value;
settings.writeFileSync(this.fileName, this.data);
}
2016-12-25 07:44:44 -08:00
}
2016-12-25 08:03:35 -08:00
module.exports = new AppConfig(remote.app.getPath('userData') + '/config.json');