Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed hipache arguments + fix markDeadBackend call

  • Loading branch information...
commit 5a43de0d138119f6121cd2ed5e4c4c3bfe859bc3 1 parent 1f9a34a
@samalba samalba authored
Showing with 12 additions and 10 deletions.
  1. +10 −8 bin/hipache
  2. +2 −2 lib/worker.js
View
18 bin/hipache
@@ -16,8 +16,8 @@ var help = [
'Starts a hipache server',
'',
'options:',
- ' --config CONFIGFILE Location of the configuration file',
- ' -h, --help Display help'
+ ' -c, --config CONFIGFILE Location of the configuration file',
+ ' -h, --help Display help'
].join('\n');
var config;
@@ -27,16 +27,18 @@ if (argv.h || argv.help) {
return util.puts(help);
}
-if (argv.config) {
- var data = fs.readFileSync(argv.config);
+if (argv.c || argv.config) {
+ var configFile = argv.c ? argv.c : argv.config;
+ var data = fs.readFileSync(configFile);
+ util.log('Loading config from ' + configFile);
config = JSON.parse(data);
} else {
- config = (function (p) {
+ config = (function (configFile) {
if (process.env.SETTINGS_FLAVOR !== undefined) {
- path = p.replace(/\.json$/, '_' + process.env.SETTINGS_FLAVOR + '.json');
+ path = configFile.replace(/\.json$/, '_' + process.env.SETTINGS_FLAVOR + '.json');
}
- util.log('Loading config from ' + p);
- var data = fs.readFileSync(p);
+ util.log('Loading config from ' + configFile);
+ var data = fs.readFileSync(configFile);
return JSON.parse(data);
}(path.resolve(__dirname, '..', 'config', 'config.json')));
}
View
4 lib/worker.js
@@ -67,7 +67,7 @@ Worker.prototype.runServer = function (config) {
req.error !== undefined) {
// This backend is dead
var backendId = req.meta.backendId;
- cache.markDeadBackend(req.meta.frontend, backendId);
+ this.cache.markDeadBackend(req.meta.frontend, backendId);
if (req.error) {
err = req.error;
// Clearing the error
@@ -86,7 +86,7 @@ Worker.prototype.runServer = function (config) {
return;
}
req.emit('retry');
- };
+ }.bind(this);
var startHandler = function (req, res) {
var remoteAddr = getRemoteAddress(req);
Please sign in to comment.
Something went wrong with that request. Please try again.