Added maintenance mode.

This commit is contained in:
DebaucheryLibrarian
2023-12-06 01:51:34 +01:00
parent a3c064be55
commit 2a3f21976a
4 changed files with 76 additions and 1 deletions

View File

@@ -162,7 +162,19 @@ async function initServer() {
});
router.use(errorHandler);
app.use(router);
if (config.web.maintenance.enabled) {
app.use(express.static('public'));
app.get('/', (req, res) => {
res.status(503).render(path.join(__dirname, '../../assets/maintenance.ejs'), {
analytics: config.analytics,
text: config.web.maintenance.text,
});
});
} else {
app.use(router);
}
const server = app.listen(config.web.port, config.web.host, () => {
const { address, port } = server.address();