This repository has been archived by the owner on Apr 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
57 lines (49 loc) · 1.61 KB
/
server.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
53
54
55
56
57
/*
___ usage: en_US ___
usage: node server.js
Launch an amalgamated agent configured and monitored by a wrapper process.
options:
-d, --dryrun
dry run to display configuration
___ usage ___
*/
var cadence = require('cadence/redux')
, logger = require('prolific').createLogger('nsp.server')
, path = require('path')
, server = require('./process/server')
, url = require('url')
require('cadence/loops')
require('arguable/executable')(module, cadence(function (async) {
var loop
, config = {
start : 'homespun,listener'
, tags : 'tags'
, clouds : path.join(__dirname, 'clouds')
, datastore : path.join(__dirname, 'datastore')
, drivers : path.join(__dirname, 'drivers')
, sandbox : path.join(__dirname, 'sandbox')
, templates : path.join(__dirname, 'templates')
/* comment out for output on stdout
, log : path.join('/', 'tmp', 'nsp.log')
*/
, dryrun : false
, listener : url.format(
{
protocol : 'http'
, slashes : true
, hostname : '0.0.0.0'
, port : 8889
})
}
async(function () {
logger.info('start', { params : config })
}, function () {
loop = async(function () {
if (config.dryrun) {
console.log(config)
return [ loop ]
}
server(config, async())
})
})
}))