forked from hoodiehq/hoodie-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
52 lines (45 loc) · 1.19 KB
/
app.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
* Initializes directories, installs dependencies then starts all
* configured servers for the Hoodie application
*/
var path = require('path'),
async = require('async'),
utils = require('./utils'),
www = require('./servers/www'),
api = require('./servers/api'),
couch = require('./servers/couch'),
admin = require('./servers/admin'),
installer = require('./installer'),
workers = require('./workers'),
prompt = require('prompt');
/**
* Initializes and starts a new Hoodie app server
*/
exports.init = function (config, callback) {
prompt.start();
prompt.message = '';
prompt.delimiter = '';
prompt.colors = false;
console.log('Initializing...');
async.applyEachSeries([
exports.ensurePaths,
couch.start,
installer.install,
www.start,
admin.start,
api.start,
workers.startAll
],
config, callback);
};
/**
* Makes sure the appropriate app directories exists
*/
exports.ensurePaths = function (config, callback) {
var paths = [
config.hoodie.path,
config.hoodie.apps_path,
config.hoodie.app_path
];
async.map(paths, utils.ensureDir, callback);
};