| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 1× 1× 1× 1× 3× 5× 5× 5× 1× 1× | /**
* Config middleware, binds a clone of app.config to ctx
**/
'use strict';
const $ = require('lodash');
const debug = require('debug')('lark.middlewares.config');
debug('loading ...');
function middleware (config = {}, app = {}) {
return (ctx, next) => {
debug('binding config ...');
ctx.config = $.cloneDeep(app.config);
return next();
}
}
debug('loaded!');
module.exports = middleware;
|