feat: Add check templates enabled middleware

This commit is contained in:
Faruk AYDIN
2025-03-06 15:30:11 +01:00
parent 67dfa822e7
commit 609360b0e6
2 changed files with 14 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
import Config from '../models/config.js';
import NotAuthorizedError from '../errors/not-authorized.js';
export const checkTemplatesEnabled = async (request, response, next) => {
const config = await Config.get();
if (!config.enableTemplates) {
throw new NotAuthorizedError();
}
next();
};