Merge pull request #2202 from bluewave-labs/feat/ignore-ssl-errors
feat: ignore ssl errors
This commit is contained in:
3 files changed
+15
No files matched your search
@@ -39,6 +39,10 @@ const MonitorSchema = mongoose.Schema(
|
|||||||
"distributed_test",
|
"distributed_test",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
ignoreTlsErrors: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
jsonPath: {
|
jsonPath: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import jmespath from "jmespath";
|
import jmespath from "jmespath";
|
||||||
|
import https from "https";
|
||||||
|
|
||||||
const SERVICE_NAME = "NetworkService";
|
const SERVICE_NAME = "NetworkService";
|
||||||
const UPROCK_ENDPOINT = "https://api.uprock.com/checkmate/push";
|
const UPROCK_ENDPOINT = "https://api.uprock.com/checkmate/push";
|
||||||
|
|
||||||
@@ -133,6 +135,7 @@ class NetworkService {
|
|||||||
name,
|
name,
|
||||||
teamId,
|
teamId,
|
||||||
type,
|
type,
|
||||||
|
ignoreTlsErrors,
|
||||||
jsonPath,
|
jsonPath,
|
||||||
matchMethod,
|
matchMethod,
|
||||||
expectedValue,
|
expectedValue,
|
||||||
@@ -141,6 +144,12 @@ class NetworkService {
|
|||||||
|
|
||||||
secret !== undefined && (config.headers = { Authorization: `Bearer ${secret}` });
|
secret !== undefined && (config.headers = { Authorization: `Bearer ${secret}` });
|
||||||
|
|
||||||
|
if (ignoreTlsErrors === true) {
|
||||||
|
config.httpsAgent = new https.Agent({
|
||||||
|
rejectUnauthorized: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const { response, responseTime, error } = await this.timeRequest(() =>
|
const { response, responseTime, error } = await this.timeRequest(() =>
|
||||||
this.axios.get(url, config)
|
this.axios.get(url, config)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -183,6 +183,7 @@ const createMonitorBodyValidation = joi.object({
|
|||||||
description: joi.string().required(),
|
description: joi.string().required(),
|
||||||
type: joi.string().required(),
|
type: joi.string().required(),
|
||||||
url: joi.string().required(),
|
url: joi.string().required(),
|
||||||
|
ignoreTlsErrors: joi.boolean().required(),
|
||||||
port: joi.number(),
|
port: joi.number(),
|
||||||
isActive: joi.boolean(),
|
isActive: joi.boolean(),
|
||||||
interval: joi.number(),
|
interval: joi.number(),
|
||||||
@@ -207,6 +208,7 @@ const editMonitorBodyValidation = joi.object({
|
|||||||
interval: joi.number(),
|
interval: joi.number(),
|
||||||
notifications: joi.array().items(joi.object()),
|
notifications: joi.array().items(joi.object()),
|
||||||
secret: joi.string(),
|
secret: joi.string(),
|
||||||
|
ignoreTlsErrors: joi.boolean(),
|
||||||
jsonPath: joi.string().allow(""),
|
jsonPath: joi.string().allow(""),
|
||||||
expectedValue: joi.string().allow(""),
|
expectedValue: joi.string().allow(""),
|
||||||
matchMethod: joi.string(),
|
matchMethod: joi.string(),
|
||||||
|
|||||||
Reference in new issue
Block a user