mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
feat: add custom server
This commit is contained in:
@@ -87,6 +87,10 @@ import { setup } from "./utils/setup";
|
|||||||
import { syncSecretsToThirdPartyServices } from "./queues/integrations/syncSecretsToThirdPartyServices";
|
import { syncSecretsToThirdPartyServices } from "./queues/integrations/syncSecretsToThirdPartyServices";
|
||||||
import { githubPushEventSecretScan } from "./queues/secret-scanning/githubScanPushEvent";
|
import { githubPushEventSecretScan } from "./queues/secret-scanning/githubScanPushEvent";
|
||||||
const SmeeClient = require("smee-client"); // eslint-disable-line
|
const SmeeClient = require("smee-client"); // eslint-disable-line
|
||||||
|
import path from "path";
|
||||||
|
import next from "next";
|
||||||
|
|
||||||
|
const dir = path.join(__dirname, "../../frontend");
|
||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
await setup();
|
await setup();
|
||||||
@@ -209,6 +213,19 @@ const main = async () => {
|
|||||||
// server status
|
// server status
|
||||||
app.use("/api", healthCheck);
|
app.use("/api", healthCheck);
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === "production") {
|
||||||
|
const nextApp = next({
|
||||||
|
dev: false,
|
||||||
|
dir
|
||||||
|
});
|
||||||
|
const nextHandler = nextApp.getRequestHandler();
|
||||||
|
await nextApp.prepare();
|
||||||
|
|
||||||
|
app.all("*", (req, res) => {
|
||||||
|
return nextHandler(req, res);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//* Handle unrouted requests and respond with proper error message as well as status code
|
//* Handle unrouted requests and respond with proper error message as well as status code
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
if (res.headersSent) return next();
|
if (res.headersSent) return next();
|
||||||
|
|||||||
Reference in New Issue
Block a user