mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-04 23:26:20 +00:00
Fix ssl stuff
This commit is contained in:
@@ -26,7 +26,7 @@ export const executeWithGateway = async <T>(
|
|||||||
gatewayId: string;
|
gatewayId: string;
|
||||||
},
|
},
|
||||||
gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">,
|
gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">,
|
||||||
operation: (baseUrl: string, httpsAgent?: https.Agent) => Promise<T>
|
operation: (baseUrl: string, httpsAgent: https.Agent) => Promise<T>
|
||||||
): Promise<T> => {
|
): Promise<T> => {
|
||||||
const { connectionDetails, gatewayId } = config;
|
const { connectionDetails, gatewayId } = config;
|
||||||
const url = new URL(connectionDetails.url);
|
const url = new URL(connectionDetails.url);
|
||||||
@@ -46,23 +46,13 @@ export const executeWithGateway = async <T>(
|
|||||||
targetHost,
|
targetHost,
|
||||||
targetPort
|
targetPort
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!platformConnectionDetails) {
|
if (!platformConnectionDetails) {
|
||||||
throw new BadRequestError({ message: "Unable to connect to gateway, no platform connection details found" });
|
throw new BadRequestError({ message: "Unable to connect to gateway, no platform connection details found" });
|
||||||
}
|
}
|
||||||
|
const httpsAgent = new https.Agent({
|
||||||
let httpsAgent: https.Agent | undefined;
|
ca: connectionDetails.sslCertificate,
|
||||||
if (connectionDetails.caCertificate) {
|
rejectUnauthorized: connectionDetails.sslRejectUnauthorized
|
||||||
httpsAgent = new https.Agent({
|
});
|
||||||
ca: connectionDetails.caCertificate,
|
|
||||||
rejectUnauthorized: !connectionDetails.skipTLSVerify
|
|
||||||
});
|
|
||||||
} else if (!connectionDetails.skipTLSVerify) {
|
|
||||||
httpsAgent = new https.Agent({
|
|
||||||
rejectUnauthorized: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return withGatewayV2Proxy(
|
return withGatewayV2Proxy(
|
||||||
async (proxyPort) => {
|
async (proxyPort) => {
|
||||||
const protocol = url.protocol === "https:" ? "https" : "http";
|
const protocol = url.protocol === "https:" ? "https" : "http";
|
||||||
|
|||||||
Reference in New Issue
Block a user