mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
refactor: Update SelfSignedSSL class to use async/await for generating SSL certificates
This commit is contained in:
parent
bf081d1ebe
commit
78bdc42534
5
CommonServer/Utils/CodeRepository/CodeRepository.ts
Normal file
5
CommonServer/Utils/CodeRepository/CodeRepository.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export default class CodeRepositoryUtil {
|
||||||
|
public static getGitCommitHashForFile(filePath: string): string {
|
||||||
|
// this is git repository.
|
||||||
|
}
|
||||||
|
}
|
18
CommonServer/Utils/Exec.ts
Normal file
18
CommonServer/Utils/Exec.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { PromiseRejectErrorFunction } from 'Common/Types/FunctionTypes';
|
||||||
|
import { ExecException, exec } from 'node:child_process';
|
||||||
|
|
||||||
|
export default class Exec {
|
||||||
|
public static exec(command: string): Promise<void> {
|
||||||
|
return new Promise(
|
||||||
|
(resolve: VoidFunction, reject: PromiseRejectErrorFunction) => {
|
||||||
|
exec(`${command}`, (err: ExecException | null) => {
|
||||||
|
if (err) {
|
||||||
|
return reject(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
return resolve();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,21 +1,9 @@
|
|||||||
import { PromiseRejectErrorFunction } from 'Common/Types/FunctionTypes';
|
import Exec from 'CommonServer/Utils/Exec';
|
||||||
import { ExecException, exec } from 'node:child_process';
|
|
||||||
|
|
||||||
export default class SelfSignedSSL {
|
export default class SelfSignedSSL {
|
||||||
public static generate(path: string, host: string): Promise<void> {
|
public static async generate(path: string, host: string): Promise<void> {
|
||||||
return new Promise(
|
return await Exec.exec(
|
||||||
(resolve: VoidFunction, reject: PromiseRejectErrorFunction) => {
|
`mkdir -p ${path} && openssl req -new -x509 -nodes -subj "/C=US/ST=NY/L=NYC/O=Global Security/OU=IT Department/CN=example.com" -out ${path}/${host}.crt -keyout ${path}/${host}.key -days 99999 && chmod -R 777 ${path}`
|
||||||
exec(
|
|
||||||
`mkdir -p ${path} && openssl req -new -x509 -nodes -subj "/C=US/ST=NY/L=NYC/O=Global Security/OU=IT Department/CN=example.com" -out ${path}/${host}.crt -keyout ${path}/${host}.key -days 99999 && chmod -R 777 ${path}`,
|
|
||||||
(err: ExecException | null) => {
|
|
||||||
if (err) {
|
|
||||||
return reject(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
return resolve();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
61
Nginx/package-lock.json
generated
61
Nginx/package-lock.json
generated
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "nginx",
|
"name": "@oneuptime/nginx",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "nginx",
|
"name": "@oneuptime/nginx",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Common": "file:../Common",
|
"Common": "file:../Common",
|
||||||
"CommonServer": "file:../CommonServer",
|
"CommonServer": "file:../CommonServer",
|
||||||
@ -19,19 +19,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"../Common": {
|
"../Common": {
|
||||||
"name": "common",
|
"name": "@oneuptime/common",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "MIT",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/crypto-js": "^4.2.2",
|
"@types/crypto-js": "^4.2.2",
|
||||||
"@types/uuid": "^8.3.4",
|
"@types/uuid": "^8.3.4",
|
||||||
"axios": "^1.6.7",
|
"axios": "^1.6.8",
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
"json5": "^2.2.3",
|
"json5": "^2.2.3",
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.30.1",
|
||||||
"moment-timezone": "^0.5.45",
|
"moment-timezone": "^0.5.45",
|
||||||
"posthog-js": "^1.105.7",
|
"posthog-js": "^1.131.4",
|
||||||
"reflect-metadata": "^0.2.1",
|
"reflect-metadata": "^0.2.2",
|
||||||
"slugify": "^1.6.5",
|
"slugify": "^1.6.5",
|
||||||
"typeorm": "^0.3.20",
|
"typeorm": "^0.3.20",
|
||||||
"uuid": "^8.3.2"
|
"uuid": "^8.3.2"
|
||||||
@ -45,49 +45,49 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"../CommonServer": {
|
"../CommonServer": {
|
||||||
"name": "common-server",
|
"name": "@oneuptime/common-server",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "MIT",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@clickhouse/client": "^0.2.9",
|
"@clickhouse/client": "^0.2.10",
|
||||||
"@elastic/elasticsearch": "^8.11.0",
|
"@elastic/elasticsearch": "^8.12.1",
|
||||||
"@opentelemetry/api": "^1.7.0",
|
"@opentelemetry/api": "^1.7.0",
|
||||||
"@opentelemetry/api-logs": "^0.48.0",
|
"@opentelemetry/api-logs": "^0.49.1",
|
||||||
"@opentelemetry/exporter-logs-otlp-http": "^0.48.0",
|
"@opentelemetry/auto-instrumentations-node": "^0.43.0",
|
||||||
"@opentelemetry/exporter-metrics-otlp-proto": "^0.48.0",
|
"@opentelemetry/exporter-logs-otlp-http": "^0.49.1",
|
||||||
"@opentelemetry/exporter-trace-otlp-proto": "^0.48.0",
|
"@opentelemetry/exporter-metrics-otlp-proto": "^0.49.1",
|
||||||
|
"@opentelemetry/exporter-trace-otlp-proto": "^0.49.1",
|
||||||
"@opentelemetry/id-generator-aws-xray": "^1.2.1",
|
"@opentelemetry/id-generator-aws-xray": "^1.2.1",
|
||||||
"@opentelemetry/instrumentation-express": "^0.35.0",
|
"@opentelemetry/sdk-logs": "^0.49.1",
|
||||||
"@opentelemetry/instrumentation-http": "^0.48.0",
|
|
||||||
"@opentelemetry/sdk-logs": "^0.48.0",
|
|
||||||
"@opentelemetry/sdk-metrics": "^1.21.0",
|
"@opentelemetry/sdk-metrics": "^1.21.0",
|
||||||
"@opentelemetry/sdk-node": "^0.48.0",
|
"@opentelemetry/sdk-node": "^0.48.0",
|
||||||
"@opentelemetry/sdk-trace-node": "^1.21.0",
|
"@opentelemetry/sdk-trace-node": "^1.21.0",
|
||||||
"@socket.io/redis-adapter": "^8.2.1",
|
"@types/crypto-js": "^4.2.2",
|
||||||
|
"acme-client": "^5.3.0",
|
||||||
"airtable": "^0.12.2",
|
"airtable": "^0.12.2",
|
||||||
"axios": "^1.6.7",
|
|
||||||
"bullmq": "^5.3.3",
|
"bullmq": "^5.3.3",
|
||||||
"Common": "file:../Common",
|
"Common": "file:../Common",
|
||||||
"cookie-parser": "^1.4.6",
|
"cookie-parser": "^1.4.6",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"cron-parser": "^4.8.1",
|
"cron-parser": "^4.8.1",
|
||||||
"dotenv": "^16.4.1",
|
"crypto-js": "^4.2.0",
|
||||||
"ejs": "^3.1.8",
|
"dotenv": "^16.4.4",
|
||||||
"express": "^4.17.3",
|
"ejs": "^3.1.10",
|
||||||
|
"express": "^4.19.2",
|
||||||
"ioredis": "^5.3.2",
|
"ioredis": "^5.3.2",
|
||||||
"json2csv": "^5.0.7",
|
"json2csv": "^5.0.7",
|
||||||
"jsonwebtoken": "^9.0.0",
|
"jsonwebtoken": "^9.0.0",
|
||||||
"markdown-it": "^13.0.1",
|
"marked": "^12.0.2",
|
||||||
"Model": "file:../Model",
|
"Model": "file:../Model",
|
||||||
"node-cron": "^3.0.3",
|
"node-cron": "^3.0.3",
|
||||||
"nodemailer": "^6.9.9",
|
"nodemailer": "^6.9.10",
|
||||||
"pg": "^8.7.3",
|
"pg": "^8.7.3",
|
||||||
|
"redis-semaphore": "^5.5.1",
|
||||||
"socket.io": "^4.7.4",
|
"socket.io": "^4.7.4",
|
||||||
"stripe": "^10.17.0",
|
"stripe": "^10.17.0",
|
||||||
"twilio": "^4.22.0",
|
"twilio": "^4.22.0",
|
||||||
"typeorm": "^0.3.20",
|
"typeorm": "^0.3.20",
|
||||||
"typeorm-extension": "^2.2.13",
|
"typeorm-extension": "^2.2.13"
|
||||||
"vm2": "^3.9.14"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@faker-js/faker": "^6.3.1",
|
"@faker-js/faker": "^6.3.1",
|
||||||
@ -98,7 +98,6 @@
|
|||||||
"@types/jest": "^27.4.1",
|
"@types/jest": "^27.4.1",
|
||||||
"@types/json2csv": "^5.0.3",
|
"@types/json2csv": "^5.0.3",
|
||||||
"@types/jsonwebtoken": "^8.5.9",
|
"@types/jsonwebtoken": "^8.5.9",
|
||||||
"@types/markdown-it": "^12.2.3",
|
|
||||||
"@types/node": "^17.0.22",
|
"@types/node": "^17.0.22",
|
||||||
"@types/node-cron": "^3.0.7",
|
"@types/node-cron": "^3.0.7",
|
||||||
"@types/nodemailer": "^6.4.7",
|
"@types/nodemailer": "^6.4.7",
|
||||||
@ -108,9 +107,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"../Model": {
|
"../Model": {
|
||||||
"name": "model",
|
"name": "@oneuptime/model",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Common": "file:../Common",
|
"Common": "file:../Common",
|
||||||
"typeorm": "^0.3.20"
|
"typeorm": "^0.3.20"
|
||||||
|
Loading…
Reference in New Issue
Block a user