properly bootstraps

This commit is contained in:
AJ ONeal 2017-05-19 05:26:26 +00:00
parent 52966e5d95
commit ec1b08dcdd
1 changed files with 2 additions and 1 deletions

3
lib/bootstrap.js vendored
View File

@ -16,7 +16,7 @@ module.exports.create = function (app, xconfx, models) {
// TODO read from file only, not db
return models.ComDaplieWalnutConfig.get('config').then(function (conf) {
if (!conf || !conf.primaryDomain/* || !conf.primaryEmail*/) {
console.log('DEBUG incomplete conf', conf);
console.log('[DEBUG] uninitialized or incomplete config:', JSON.stringify(conf));
return false;
}
@ -155,6 +155,7 @@ module.exports.create = function (app, xconfx, models) {
var configpath = path.join(__dirname, '..', '..', 'config', config.domain + '.json');
safeConfig = { primaryDomain: config.domain };
xconfx.primaryDomain = safeConfig.primaryDomain;
return fs.writeFileAsync(configpath, JSON.stringify(safeConfig, null, ' '), 'utf8').then(function () {
// TODO nix SQL
return models.ComDaplieWalnutConfig.upsert('config', safeConfig);