fix: handle SIGTERM in dashboard serve.js; always include API_URL in webpack build

This commit is contained in:
Dragory 2024-03-30 15:47:38 +00:00
parent f3fcede7f5
commit 9e65f05b23
No known key found for this signature in database
2 changed files with 7 additions and 2 deletions

View file

@ -17,3 +17,9 @@ fastify.listen({ port: 3002, host: '0.0.0.0' }, (err, address) => {
} }
console.log(`Server listening on ${address}`); console.log(`Server listening on ${address}`);
}); });
process.on("SIGTERM", () => {
fastify.close().then(() => {
process.exit(0);
});
});

View file

@ -153,6 +153,7 @@ let config = {
new DotenvPlugin({ new DotenvPlugin({
path: path.resolve(process.cwd(), "../.env"), path: path.resolve(process.cwd(), "../.env"),
}), }),
new webpack.EnvironmentPlugin(["API_URL"]),
], ],
resolve: { resolve: {
extensions: [".ts", ".tsx", ".js", ".mjs", ".vue"], extensions: [".ts", ".tsx", ".js", ".mjs", ".vue"],
@ -161,8 +162,6 @@ let config = {
}, },
}; };
if (process.env.NODE_ENV === "web") config.plugins.push(new webpack.EnvironmentPlugin(["NODE_ENV", "API_URL"]));
if (process.env.NODE_ENV === "production") { if (process.env.NODE_ENV === "production") {
config = merge(config, { config = merge(config, {
mode: "production", mode: "production",