Skip to content

Commit

Permalink
Added magic key support
Browse files Browse the repository at this point in the history
  • Loading branch information
aalonsog committed Jan 19, 2015
1 parent 136d2e1 commit e9a3766
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config.js.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ config.password = 'pepProxy';

config.check_permissions = false;

config.magic_key = undefined;

module.exports = config;
13 changes: 13 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,19 @@ app.all('/*', function(req, res) {
res.send(401, 'Auth-token not found in request header');
} else {

if (config.magic_key && config.magic_key === auth_token) {
var options = {
host: config.app_host,
port: config.app_port,
path: req.url,
method: req.method,
headers: proxy.getClientIp(req, req.headers)
};
proxy.sendData('http', options, req.body, res);
return;

}

var action, resource;

if (config.check_permissions) {
Expand Down

0 comments on commit e9a3766

Please sign in to comment.