Prepare Soundbox Ops deployment
This commit is contained in:
23
src/app.ts
23
src/app.ts
@ -23,6 +23,26 @@ const app = express();
|
||||
if (env.TRUST_PROXY === "true") {
|
||||
app.set("trust proxy", 1);
|
||||
}
|
||||
|
||||
const allowedPreviewOrigins = new Set([
|
||||
"http://127.0.0.1:4173",
|
||||
"http://localhost:4173"
|
||||
]);
|
||||
|
||||
app.use((req, res, next) => {
|
||||
const origin = req.header("origin");
|
||||
if (origin && allowedPreviewOrigins.has(origin)) {
|
||||
res.header("Access-Control-Allow-Origin", origin);
|
||||
res.header("Vary", "Origin");
|
||||
res.header("Access-Control-Allow-Headers", "authorization, content-type, x-request-id, idempotency-key");
|
||||
res.header("Access-Control-Allow-Methods", "GET,POST,PATCH,PUT,DELETE,OPTIONS");
|
||||
}
|
||||
if (req.method === "OPTIONS") {
|
||||
return res.sendStatus(204);
|
||||
}
|
||||
return next();
|
||||
});
|
||||
|
||||
startNotificationOrchestrator();
|
||||
startDynamicQrExpiryScheduler();
|
||||
startExportJobWorker();
|
||||
@ -105,8 +125,7 @@ function resolveUiPageFile(slug: string) {
|
||||
}
|
||||
|
||||
app.get("/ui", (_req, res) => {
|
||||
const filePath = path.resolve(process.cwd(), "ui/index.html");
|
||||
res.sendFile(filePath);
|
||||
res.redirect(302, "/ui/soundbox-ops");
|
||||
});
|
||||
|
||||
app.get("/ui/hub", (_req, res) => {
|
||||
|
||||
Reference in New Issue
Block a user