Refactor configuration out into reusable files

This commit is contained in:
David Balatero 2017-06-21 18:04:19 -07:00 committed by Scott Nonnenberg
parent ed831dacd0
commit 5e5ca80a6e
No known key found for this signature in database
GPG key ID: A4931C09644C654B
4 changed files with 84 additions and 55 deletions

22
app/user_config.js Normal file
View file

@ -0,0 +1,22 @@
const app = require('electron').app;
const path = require('path');
const ElectronConfig = require('electron-config');
const config = require('./config');
// use a separate data directory for development
if (config.has('storageProfile')) {
const userData = path.join(
app.getPath('appData'),
'Signal-' + config.get('storageProfile')
);
app.setPath('userData', userData);
}
console.log('userData ' + app.getPath('userData'));
// this needs to be below our update to the appData path
const userConfig = new ElectronConfig();
module.exports = userConfig;