-
Notifications
You must be signed in to change notification settings - Fork 1
/
haproxy.js
37 lines (32 loc) · 1.07 KB
/
haproxy.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
var haproxyMod = new require('haproxy'),
compiler = require('./compiler'),
HAProxy = haproxyMod({
config : __dirname + '/tempfiles/haproxy.cfg',
pidFile : __dirname + '/tempfiles/haproxy.pid'
});
module.exports = {
init : function () {
var all = true; // Kill all running Haproxy
HAProxy.stop(all, function(err){
compiler(); //Compile and create the HAP config
HAProxy.start(function (err) {
if(err) {console.log(err); return;}
else console.log(' .. HAP started ..');
});
});
},
restart : function (cb) {
/*HAProxy.reload(function (err) {
if(err) {console.log(err); return cb(err);}
else console.log(' .. HAP reloaded ..');
cb();
});*/
var all = true; // Kill all running Haproxy
HAProxy.stop(all, function(err){
HAProxy.start(function (err) {
if(err) {console.log(err); return;}
else console.log(' .. HAP started ..');
});
});
}
};