Skip to content

Commit

Permalink
check spec.enabled while recursing
Browse files Browse the repository at this point in the history
  • Loading branch information
jasisk committed May 22, 2015
1 parent eba6291 commit 70ba124
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ function resolvery(basedir) {
return function resolve(spec, name) {
var fns, fn;

if (!spec.enabled && 'enabled' in spec) {
return;
}

spec.name = spec.name || name;

if (spec.parallel) {
Expand Down Expand Up @@ -106,6 +110,7 @@ function resolveImpl(root, config) {
* @returns {Function}
*/
function middleware(requestory, fns) {
fns = fns.filter(function (fn) { return !!fn; });
var rq = requestory(fns.map(taskery));
return function composite(req, res, next) {
function complete(success, failure) {
Expand Down Expand Up @@ -190,11 +195,10 @@ module.exports = function meddleware(settings) {
.forEach(function register(spec) {
var fn, eventargs, route;

if (!spec.enabled && 'enabled' in spec) {
if (!(fn = resolve(spec, spec.name))) {
return;
}

fn = resolve(spec, spec.name);
eventargs = { app: parent, config: spec };

if (thing.isArray(spec.route)) {
Expand Down

0 comments on commit 70ba124

Please sign in to comment.