File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ class API {
3232 constructor ( config ) {
3333 this . config = {
3434 ...sharedConfig ( 'API' ) ,
35+ // <https://github.com/ladjs/bull>
36+ // this is an instance of bull passed to context
37+ // so users can use it in routes, e.g. `ctx.bull`
38+ bull : false ,
3539 ...config
3640 } ;
3741
@@ -79,6 +83,10 @@ class API {
7983 // <https://github.com/sindresorhus/eslint-plugin-unicorn/issues/174>
8084 app . context . onerror = errorHandler ;
8185
86+ // set bull to be shared throughout app context
87+ // (very useful for not creating additional connections)
88+ if ( this . config . bull ) app . context . bull = this . config . bull ;
89+
8290 // adds request received hrtime and date symbols to request object
8391 // (which is used by Cabin internally to add `request.timestamp` to logs
8492 app . use ( requestReceived ) ;
You can’t perform that action at this time.
0 commit comments