mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-09 13:28:27 +00:00
misc: addressed greptile
This commit is contained in:
@@ -62,31 +62,21 @@ export const KubernetesProvider = ({ gatewayService }: TKubernetesProviderDTO):
|
|||||||
const serviceAccountGetCallback = async (host: string, port: number) => {
|
const serviceAccountGetCallback = async (host: string, port: number) => {
|
||||||
const baseUrl = port ? `${host}:${port}` : host;
|
const baseUrl = port ? `${host}:${port}` : host;
|
||||||
|
|
||||||
try {
|
await axios.get(
|
||||||
await axios.get(
|
`${baseUrl}/api/v1/namespaces/${providerInputs.namespace}/serviceaccounts/${providerInputs.serviceAccountName}`,
|
||||||
`${baseUrl}/api/v1/namespaces/${providerInputs.namespace}/serviceaccounts/${providerInputs.serviceAccountName}`,
|
{
|
||||||
{
|
headers: {
|
||||||
headers: {
|
"Content-Type": "application/json",
|
||||||
"Content-Type": "application/json",
|
Authorization: `Bearer ${providerInputs.clusterToken}`
|
||||||
Authorization: `Bearer ${providerInputs.clusterToken}`
|
},
|
||||||
},
|
signal: AbortSignal.timeout(EXTERNAL_REQUEST_TIMEOUT),
|
||||||
signal: AbortSignal.timeout(EXTERNAL_REQUEST_TIMEOUT),
|
timeout: EXTERNAL_REQUEST_TIMEOUT,
|
||||||
timeout: EXTERNAL_REQUEST_TIMEOUT,
|
httpsAgent: new https.Agent({
|
||||||
httpsAgent: new https.Agent({
|
ca: providerInputs.ca,
|
||||||
ca: providerInputs.ca,
|
rejectUnauthorized: providerInputs.sslEnabled
|
||||||
rejectUnauthorized: providerInputs.sslEnabled
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return true;
|
|
||||||
} catch (err) {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
||||||
if (axios.isAxiosError(err) && err.response?.data.message) {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
||||||
throw new Error(`Failed to validate connection: ${err.response.data.message}`);
|
|
||||||
}
|
}
|
||||||
throw err;
|
);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const url = new URL(providerInputs.url);
|
const url = new URL(providerInputs.url);
|
||||||
|
|||||||
Reference in New Issue
Block a user