-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwebtask.js
More file actions
27 lines (23 loc) · 793 Bytes
/
webtask.js
File metadata and controls
27 lines (23 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const tools = require("auth0-extension-express-tools");
const expressApp = require("./server");
const config = require("./server/lib/config");
const logger = require("./server/lib/logger");
const { version: extensionVersion } = require("./webtask.json");
process.on("uncaughtException", err => {
console.error(err);
});
const createServer = tools.createServer((cfg, storage) => {
logger.verbose(
"Starting Idp Redirector Extension - Version:",
extensionVersion
);
return expressApp(cfg, storage);
});
module.exports = (context, req, res) => {
const publicUrl =
(req.x_wt && req.x_wt.ectx && req.x_wt.ectx.PUBLIC_WT_URL) || false;
if (!publicUrl) {
config.setValue("PUBLIC_WT_URL", tools.urlHelpers.getWebtaskUrl(req));
}
createServer(context, req, res);
};