mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 23:30:10 +00:00
fix compile errors
This commit is contained in:
parent
f08cbf0568
commit
9269606c76
@ -7,6 +7,7 @@ import {
|
||||
|
||||
import { sendErrorResponse } from '../Utils/Response';
|
||||
import BadDataException from 'Common/Types/Exception/BadDataException';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
|
||||
export default class ClusterKeyAuthorization {
|
||||
public static async isAuthorizedService(
|
||||
@ -14,22 +15,17 @@ export default class ClusterKeyAuthorization {
|
||||
res: ExpressResponse,
|
||||
next: NextFunction
|
||||
): Promise<void> {
|
||||
let clusterKey: string;
|
||||
let clusterKey: ObjectID;
|
||||
|
||||
if (req.params && req.params['clusterKey']) {
|
||||
clusterKey = req.params['clusterKey'];
|
||||
clusterKey = new ObjectID(req.params['clusterKey']);
|
||||
} else if (req.query && req.query['clusterKey']) {
|
||||
clusterKey = req.query['clusterKey'] as string;
|
||||
} else if (
|
||||
req.headers &&
|
||||
(req.headers['clusterkey'] || req.headers['clusterkey'])
|
||||
) {
|
||||
clusterKey = new ObjectID(req.query['clusterKey'] as string);
|
||||
} else if (req.headers && req.headers['clusterkey']) {
|
||||
// Header keys are automatically transformed to lowercase
|
||||
clusterKey =
|
||||
(req.headers['clusterkey'] as string) ||
|
||||
(req.headers['clusterkey'] as string);
|
||||
clusterKey = new ObjectID(req.headers['clusterkey'] as string);
|
||||
} else if (req.body && req.body.clusterKey) {
|
||||
clusterKey = req.body.clusterKey;
|
||||
clusterKey = new ObjectID(req.body.clusterKey);
|
||||
} else {
|
||||
return sendErrorResponse(
|
||||
req,
|
||||
|
@ -137,8 +137,11 @@ export default class MailService {
|
||||
// Localcache templates, so we dont read from disk all the time.
|
||||
|
||||
let templateData: string;
|
||||
if (LocalCache.hasValue(emailTemplateType)) {
|
||||
templateData = LocalCache.get(emailTemplateType);
|
||||
if (LocalCache.hasValue('email-templates', emailTemplateType)) {
|
||||
templateData = LocalCache.get(
|
||||
'email-templates',
|
||||
emailTemplateType
|
||||
) as string;
|
||||
} else {
|
||||
templateData = await fsp.readFile(
|
||||
Path.resolve(
|
||||
@ -148,7 +151,11 @@ export default class MailService {
|
||||
),
|
||||
{ encoding: 'utf8', flag: 'r' }
|
||||
);
|
||||
LocalCache.set(emailTemplateType, templateData);
|
||||
LocalCache.set(
|
||||
'email-templates',
|
||||
emailTemplateType,
|
||||
templateData as string
|
||||
);
|
||||
}
|
||||
|
||||
const emailBody: Handlebars.TemplateDelegate =
|
||||
|
Loading…
Reference in New Issue
Block a user