X-Git-Url: http://git.squeep.com/?p=squeep-indie-auther;a=blobdiff_plain;f=src%2Fservice.js;fp=src%2Fservice.js;h=0b9147534c2962b3c6accaa99d391afe68a39bef;hp=5fbf95055b38b964d15f0e0d369f72233c13f6a9;hb=8ed17e3fb2fe838398036aef5b2a9398fd608375;hpb=77c93a5594f97910b501c4711b18d64c73cb3d94 diff --git a/src/service.js b/src/service.js index 5fbf950..0b91475 100644 --- a/src/service.js +++ b/src/service.js @@ -17,12 +17,12 @@ const Enum = require('./enum'); const _fileScope = common.fileScope(__filename); class Service extends Dingus { - constructor(logger, db, options) { + constructor(logger, db, options, asyncLocalStorage) { super(logger, { ...options.dingus, ignoreTrailingSlash: false, }); - + this.asyncLocalStorage = asyncLocalStorage; this.staticPath = path.normalize(path.join(__dirname, '..', 'static')); this.manager = new Manager(logger, db, options); this.authenticator = new Authenticator(logger, db, options); @@ -103,6 +103,10 @@ class Service extends Dingus { async preHandler(req, res, ctx) { await super.preHandler(req, res, ctx); ctx.url = req.url; // Persist this for logout redirect + + const logObject = this.asyncLocalStorage.getStore(); + logObject.requestId = ctx.requestId; + delete ctx.requestId; }