mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
fix lint.
This commit is contained in:
@@ -65,17 +65,13 @@ class Express {
|
||||
|
||||
public static async launchApplication(
|
||||
appName: string,
|
||||
port?: Port,
|
||||
port?: Port
|
||||
): Promise<express.Application> {
|
||||
|
||||
if (!this.app) {
|
||||
this.setupExpress();
|
||||
}
|
||||
|
||||
|
||||
|
||||
return new Promise<express.Application>((resolve: Function) => {
|
||||
|
||||
this.app.listen(port?.toNumber() || this.app.get('port'), () => {
|
||||
// eslint-disable-next-line
|
||||
logger.info(`${appName} server started on port: ${port?.toNumber() || this.app.get('port')}`);
|
||||
|
||||
@@ -93,7 +93,7 @@ app.use(logRequest);
|
||||
|
||||
const init: Function = async (
|
||||
appName: string,
|
||||
port?: Port,
|
||||
port?: Port
|
||||
): Promise<ExpressApplication> => {
|
||||
await Express.launchApplication(appName, port);
|
||||
LocalCache.setString('app', 'name', appName);
|
||||
|
||||
@@ -47,7 +47,6 @@ export default class GreenlockCertificate extends BaseModel {
|
||||
})
|
||||
public blob?: string = undefined;
|
||||
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [],
|
||||
read: [],
|
||||
|
||||
@@ -55,7 +55,6 @@ app.get(
|
||||
app.get(
|
||||
'/status-page-api/cname-verification/:token',
|
||||
async (req: ExpressRequest, res: ExpressResponse) => {
|
||||
|
||||
const host: string | undefined = req.get('host');
|
||||
|
||||
if (!host) {
|
||||
|
||||
@@ -30,7 +30,6 @@ const init: Function = async (): Promise<void> => {
|
||||
await PostgresAppInstance.connect(
|
||||
PostgresAppInstance.getDatasourceOptions()
|
||||
);
|
||||
|
||||
} catch (err) {
|
||||
logger.error('App Init Failed:');
|
||||
logger.error(err);
|
||||
|
||||
@@ -18,7 +18,7 @@ import ClusterKeyAuthorization from 'CommonServer/Middleware/ClusterKeyAuthoriza
|
||||
import { JSONObject } from 'Common/Types/JSON';
|
||||
import Response from 'CommonServer/Utils/Response';
|
||||
import LIMIT_MAX from 'Common/Types/Database/LimitMax';
|
||||
import axios from 'axios';
|
||||
import axios, { AxiosResponse } from 'axios';
|
||||
import GreenlockCertificate from 'Model/Models/GreenlockCertificate';
|
||||
import GreenlockCertificateService from 'CommonServer/Services/GreenlockCertificateService';
|
||||
import fs from 'fs';
|
||||
@@ -326,7 +326,6 @@ RunCron(
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
RunCron(
|
||||
'StatusPageCerts:WriteCertsToDisk',
|
||||
IsDevelopment ? EVERY_MINUTE : EVERY_HOUR,
|
||||
@@ -335,12 +334,10 @@ RunCron(
|
||||
|
||||
const certs: Array<GreenlockCertificate> =
|
||||
await GreenlockCertificateService.findBy({
|
||||
query: {
|
||||
|
||||
},
|
||||
query: {},
|
||||
select: {
|
||||
isKeyPair: true,
|
||||
key: true,
|
||||
key: true,
|
||||
blob: true,
|
||||
},
|
||||
limit: LIMIT_MAX,
|
||||
@@ -355,18 +352,30 @@ RunCron(
|
||||
continue;
|
||||
}
|
||||
|
||||
const certBlob = certs.find((i) => i.key === cert.key && !i.isKeyPair);
|
||||
|
||||
const certBlob: GreenlockCertificate | undefined = certs.find(
|
||||
(i: GreenlockCertificate) => {
|
||||
return i.key === cert.key && !i.isKeyPair;
|
||||
}
|
||||
);
|
||||
|
||||
if (!certBlob) {
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
const key = JSON.parse(cert.blob || '{}').privateKeyPem;
|
||||
const crt = JSON.parse(certBlob.blob || '{}').cert;
|
||||
const key: string = JSON.parse(cert.blob || '{}').privateKeyPem;
|
||||
const crt: string = JSON.parse(certBlob.blob || '{}').cert;
|
||||
|
||||
// Write to disk.
|
||||
fs.writeFileSync(`/usr/src/Certs/StatusPageCerts/${cert.key}.crt`, crt, { flag: 'wx' });
|
||||
fs.writeFileSync(`/usr/src/Certs/StatusPageCerts/${cert.key}.key`, key, { flag: 'wx' });
|
||||
// Write to disk.
|
||||
fs.writeFileSync(
|
||||
`/usr/src/Certs/StatusPageCerts/${cert.key}.crt`,
|
||||
crt,
|
||||
{ flag: 'wx' }
|
||||
);
|
||||
fs.writeFileSync(
|
||||
`/usr/src/Certs/StatusPageCerts/${cert.key}.key`,
|
||||
key,
|
||||
{ flag: 'wx' }
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -437,11 +446,11 @@ const checkCnameValidation: Function = async (
|
||||
logger.info('Check CNAMeValidation.');
|
||||
|
||||
try {
|
||||
const agent = new https.Agent({
|
||||
const agent: https.Agent = new https.Agent({
|
||||
rejectUnauthorized: false,
|
||||
});
|
||||
|
||||
const result = await axios.get(
|
||||
const result: AxiosResponse = await axios.get(
|
||||
'https://' +
|
||||
fulldomain +
|
||||
'/status-page-api/cname-verification/' +
|
||||
@@ -463,7 +472,7 @@ const isSslProvisioned: Function = async (
|
||||
token: string
|
||||
): Promise<boolean> => {
|
||||
try {
|
||||
const result = await axios.get(
|
||||
const result: AxiosResponse = await axios.get(
|
||||
'https://' +
|
||||
fulldomain +
|
||||
'/status-page-api/cname-verification/' +
|
||||
|
||||
@@ -17,7 +17,7 @@ module.exports = {
|
||||
|
||||
const ch: any = data.challenge;
|
||||
const key: string = ch.identifier.value + '#' + ch.token;
|
||||
const token: string = ch.token;
|
||||
const token: string = ch.token;
|
||||
|
||||
let challenge: GreenlockChallenge | null =
|
||||
await GreenlockChallengeService.findOneBy({
|
||||
@@ -107,7 +107,6 @@ module.exports = {
|
||||
|
||||
return null;
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -8,17 +8,17 @@ module.exports = {
|
||||
const saveCertificate: Function = async (
|
||||
id: string,
|
||||
blob: string,
|
||||
isKeyPair: boolean,
|
||||
isKeyPair: boolean
|
||||
): Promise<null> => {
|
||||
let cert: GreenlockCertificate | null =
|
||||
await GreenlockCertificateService.findOneBy({
|
||||
query: {
|
||||
key: id,
|
||||
isKeyPair: isKeyPair
|
||||
isKeyPair: isKeyPair,
|
||||
},
|
||||
select: {
|
||||
_id: true,
|
||||
isKeyPair: isKeyPair
|
||||
isKeyPair: isKeyPair,
|
||||
},
|
||||
props: {
|
||||
isRoot: true,
|
||||
@@ -62,7 +62,7 @@ module.exports = {
|
||||
await GreenlockCertificateService.findOneBy({
|
||||
query: {
|
||||
key: id,
|
||||
isKeyPair: isKeyPair
|
||||
isKeyPair: isKeyPair,
|
||||
},
|
||||
select: {
|
||||
_id: true,
|
||||
@@ -102,10 +102,7 @@ module.exports = {
|
||||
opts.account.id || opts.email || 'default';
|
||||
const keypair: any = opts.keypair;
|
||||
|
||||
return await saveKeypair(
|
||||
id,
|
||||
JSON.stringify(keypair)
|
||||
); // Must return or Promise `null` instead of `undefined`
|
||||
return await saveKeypair(id, JSON.stringify(keypair)); // Must return or Promise `null` instead of `undefined`
|
||||
},
|
||||
// We need a way to retrieve a prior account's keypair for renewals and additional ACME certificate "orders"
|
||||
checkKeypair: async (opts: any): Promise<any | null> => {
|
||||
@@ -131,10 +128,7 @@ module.exports = {
|
||||
opts.subject;
|
||||
const keypair: any = opts.keypair;
|
||||
|
||||
return await saveKeypair(
|
||||
id,
|
||||
JSON.stringify(keypair)
|
||||
); // Must return or Promise `null` instead of `undefined`
|
||||
return await saveKeypair(id, JSON.stringify(keypair)); // Must return or Promise `null` instead of `undefined`
|
||||
// Side Note: you can use the "keypairs" package to convert between
|
||||
// public and private for jwk and pem, as well as convert JWK <-> PEM
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user