-
Notifications
You must be signed in to change notification settings - Fork 3
/
production.js
60 lines (47 loc) · 1.35 KB
/
production.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
58
59
60
var getenv = require('getenv');
_ = require('lodash'); // require lodash globally
request = require('request-promise'); // require requestpromise globally
shellQuoteParse = require('shell-quote').parse;
// create the global config
config = {
'dpdServerRoot' : getenv('SM_DPD_SERVER_ROOT'),
'sm_apikey': '2a2f7dbfcee845adc541d28d43b41792',
'mashape_apikey': getenv('MASHAPE_APIKEY'),
'dpd_port' : 2403,
'dpd_env' : 'development',
'sm_api_root': 'http://dev-api.webaroo.com/sm/api/'
};
init(config);
function init(config){
console.log("Welcome to deployd! Config loaded!");
_.forEach(config, function(n, key){
console.log(key, " : ", n);
});
var deployd = require('deployd');
var deploydOptions = {
port: config.dpd_port,
env: config.dpd_env
};
var dpd = deployd(deploydOptions);
dpd.listen();
dpd.on('listening', function() {
console.log("Deployd is listening on port ", deploydOptions.port);
});
dpd.on('error', function(err) {
console.error(err);
process.nextTick(function() { // Give the server a chance to return an error
process.exit();
});
});
console.log("");
}
//
// global functions
//
getHeaders = function getHeaders(){
return {
'content-type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache',
'apikey' : config.sm_apikey
};
};