drudge/node-gitlab-webhook — pull request #1 by zxqfox (2014-04-03 03:45:02+00:00)
Title: truly middlewared

Moved execution helpers to runner
Created filters for ips/branches/tokens, added possibility to provide callback to each of them
Added possibility to provide callback to exec/execLog
Implemented webhookKey property to pass gitlab data to express request object

New syntax is more clean:
```js
webhook = requre('gitlab-webhook');
app.post('/test',
webhook({
strict: true, // throw errors instead of bypassing route, as was before
ips: false, // don't filter by ip
token: function () { return true; },
exec: 'echo "{{ref}}"; echo "{{user_id}}"; echo "{{payload.repository.homepage}}";',
execLog: function (d) {
return process.cwd() + '/logs/' + (d.ref.replace(/[^a-z0-9\-]+/ig,'-')) + '.exec_log';
}
}),
function (req, res) {
console.log(req.webhook);
res.send(204);
res.end();
});
```

Tell me what you think about it.