forked from gupshup-io/deployd-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproduction.js
More file actions
70 lines (57 loc) · 1.63 KB
/
production.js
File metadata and controls
70 lines (57 loc) · 1.63 KB
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
61
62
63
64
65
66
67
68
69
70
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_port' : process.env.PORT ,
'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,
db: {
host: 'ds013898.mongolab.com',
port: 13898,
name: 'heroku_pr3c8xhr',
credentials: {
username: 'heroku_pr3c8xhr',
password: '20gpo4e6f3jinr9aqkphncs86g'
}
}
};
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
};
};