-
Notifications
You must be signed in to change notification settings - Fork 148
/
Copy pathindex.js
33 lines (30 loc) · 1.02 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use strict';
//
// Load all the fixtures and inject in all configuration resources.
// 1. Push the ../config files (local configuration, may be used in next steps)
// 2. Store the ESN configuration files into mongo
//
// Each configuration feature live in its module. On each module, index.js will be called and
// it is up to the index to copy/store/inject configuration at the rigth place.
//
var copyFileConfig = require('./config');
var setEsnConfig = require('./esn-config');
var populateDb = require('./populate');
var db = require('./db');
module.exports = function(done) {
copyFileConfig()
.then(db.connectFromFileConfig)
.then(setEsnConfig)
.then(populateDb)
.then(function() {
console.log('Created 1 domain, 20 users and 1 admin.');
console.log('Success ! You have a working ESN !');
done(true);
})
.catch(function(err) {
console.log('[ERROR] Cannot inject fixtures, aborting...');
console.log('[ERROR] ', err.message);
done(false);
})
.finally(db.disconnect);
};