reject unauthorized
This commit is contained in:
1 parent
686b96d4b3
commit
5876b97ede
19 files changed
+37
-14
No files matched your search
@@ -29,6 +29,7 @@ export interface IMonitor extends Document {
|
||||
secret?: string;
|
||||
type: MonitorType;
|
||||
interval: number; // in ms
|
||||
rejectUnauthorized: boolean;
|
||||
status: MonitorStatus;
|
||||
n: number; // Number of consecutive successes required to change status
|
||||
lastCheckedAt?: Date;
|
||||
@@ -58,6 +59,7 @@ const MonitorSchema = new Schema<IMonitor>(
|
||||
enum: MonitorTypes,
|
||||
},
|
||||
interval: { type: Number, required: true, default: 60000 },
|
||||
rejectUnauthorized: { type: Boolean, required: true, default: true },
|
||||
status: {
|
||||
type: String,
|
||||
required: true,
|
||||
|
||||
@@ -623,6 +623,7 @@ class MonitorService implements IMonitorService {
|
||||
"name",
|
||||
"secret",
|
||||
"interval",
|
||||
"rejectUnauthorized",
|
||||
"n",
|
||||
"notificationChannels",
|
||||
];
|
||||
|
||||
@@ -119,7 +119,9 @@ class NetworkService implements INetworkService {
|
||||
|
||||
let certificateExpiry: Date | null = null;
|
||||
try {
|
||||
const req: any = this.client(url);
|
||||
const req: any = this.client(url, {
|
||||
https: { rejectUnauthorized: monitor.rejectUnauthorized },
|
||||
});
|
||||
req.on("request", (nodeReq: ClientRequest) => {
|
||||
nodeReq.on("socket", (socket: TLSSocket) => {
|
||||
const capture = () => {
|
||||
|
||||
@@ -60,6 +60,7 @@ export const monitorSchema = z
|
||||
notificationChannels: z.array(z.string()).optional().default([]),
|
||||
secret: z.string().optional(),
|
||||
interval: z.number({ message: "Interval required" }),
|
||||
rejectUnauthorized: z.boolean().default(true),
|
||||
})
|
||||
.superRefine((data, ctx) => {
|
||||
const minIntervals: Record<string, number> = {
|
||||
|
||||
Reference in new issue
Block a user