Add more Accept-Encoding to integrations syncs

This commit is contained in:
Tuan Dang
2023-02-19 13:42:37 +07:00
parent 8432f71d58
commit 20e7eae4fe
+26 -8
View File
@@ -30,7 +30,6 @@ import {
INTEGRATION_FLYIO_API_URL, INTEGRATION_FLYIO_API_URL,
INTEGRATION_CIRCLECI_API_URL, INTEGRATION_CIRCLECI_API_URL,
} from "../variables"; } from "../variables";
import { access, appendFile } from "fs";
/** /**
* Sync/push [secrets] to [app] in integration named [integration] * Sync/push [secrets] to [app] in integration named [integration]
@@ -181,7 +180,8 @@ const syncSecretsAzureKeyVault = async ({
while (url) { while (url) {
const res = await axios.get(url, { const res = await axios.get(url, {
headers: { headers: {
Authorization: `Bearer ${accessToken}` Authorization: `Bearer ${accessToken}`,
'Accept-Encoding': 'application/json'
} }
}); });
@@ -202,7 +202,8 @@ const syncSecretsAzureKeyVault = async ({
const azureKeyVaultSecret = await axios.get(`${getAzureKeyVaultSecret.id}?api-version=7.3`, { const azureKeyVaultSecret = await axios.get(`${getAzureKeyVaultSecret.id}?api-version=7.3`, {
headers: { headers: {
'Authorization': `Bearer ${accessToken}` 'Authorization': `Bearer ${accessToken}`,
'Accept-Encoding': 'application/json'
} }
}); });
@@ -259,7 +260,8 @@ const syncSecretsAzureKeyVault = async ({
}, },
{ {
headers: { headers: {
Authorization: `Bearer ${accessToken}` Authorization: `Bearer ${accessToken}`,
'Accept-Encoding': 'application/json'
} }
} }
); );
@@ -270,7 +272,8 @@ const syncSecretsAzureKeyVault = async ({
deleteSecrets.forEach(async (secret) => { deleteSecrets.forEach(async (secret) => {
await axios.delete(`${integration.app}/secrets/${secret.key}?api-version=7.3`, { await axios.delete(`${integration.app}/secrets/${secret.key}?api-version=7.3`, {
headers: { headers: {
'Authorization': `Bearer ${accessToken}` 'Authorization': `Bearer ${accessToken}`,
'Accept-Encoding': 'application/json'
} }
}); });
}); });
@@ -488,6 +491,7 @@ const syncSecretsHeroku = async ({
headers: { headers: {
Accept: "application/vnd.heroku+json; version=3", Accept: "application/vnd.heroku+json; version=3",
Authorization: `Bearer ${accessToken}`, Authorization: `Bearer ${accessToken}`,
'Accept-Encoding': 'application/json'
}, },
} }
) )
@@ -506,6 +510,7 @@ const syncSecretsHeroku = async ({
headers: { headers: {
Accept: "application/vnd.heroku+json; version=3", Accept: "application/vnd.heroku+json; version=3",
Authorization: `Bearer ${accessToken}`, Authorization: `Bearer ${accessToken}`,
'Accept-Encoding': 'application/json'
}, },
} }
); );
@@ -552,7 +557,7 @@ const syncSecretsVercel = async ({
} }
: {}), : {}),
}; };
const res = ( const res = (
await Promise.all( await Promise.all(
( (
@@ -561,7 +566,8 @@ const syncSecretsVercel = async ({
{ {
params, params,
headers: { headers: {
Authorization: `Bearer ${accessToken}` Authorization: `Bearer ${accessToken}`,
'Accept-Encoding': 'application/json'
} }
} }
)) ))
@@ -573,7 +579,8 @@ const syncSecretsVercel = async ({
{ {
params, params,
headers: { headers: {
Authorization: `Bearer ${accessToken}` Authorization: `Bearer ${accessToken}`,
'Accept-Encoding': 'application/json'
} }
} }
)).data) )).data)
@@ -633,6 +640,7 @@ const syncSecretsVercel = async ({
params, params,
headers: { headers: {
Authorization: `Bearer ${accessToken}`, Authorization: `Bearer ${accessToken}`,
'Accept-Encoding': 'application/json'
}, },
} }
); );
@@ -649,6 +657,7 @@ const syncSecretsVercel = async ({
params, params,
headers: { headers: {
Authorization: `Bearer ${accessToken}`, Authorization: `Bearer ${accessToken}`,
'Accept-Encoding': 'application/json'
}, },
} }
); );
@@ -664,6 +673,7 @@ const syncSecretsVercel = async ({
params, params,
headers: { headers: {
Authorization: `Bearer ${accessToken}`, Authorization: `Bearer ${accessToken}`,
'Accept-Encoding': 'application/json'
}, },
} }
); );
@@ -723,6 +733,7 @@ const syncSecretsNetlify = async ({
params: getParams, params: getParams,
headers: { headers: {
Authorization: `Bearer ${accessToken}`, Authorization: `Bearer ${accessToken}`,
'Accept-Encoding': 'application/json'
}, },
} }
) )
@@ -837,6 +848,7 @@ const syncSecretsNetlify = async ({
params: syncParams, params: syncParams,
headers: { headers: {
Authorization: `Bearer ${accessToken}`, Authorization: `Bearer ${accessToken}`,
'Accept-Encoding': 'application/json'
}, },
} }
); );
@@ -854,6 +866,7 @@ const syncSecretsNetlify = async ({
params: syncParams, params: syncParams,
headers: { headers: {
Authorization: `Bearer ${accessToken}`, Authorization: `Bearer ${accessToken}`,
'Accept-Encoding': 'application/json'
}, },
} }
); );
@@ -868,6 +881,7 @@ const syncSecretsNetlify = async ({
params: syncParams, params: syncParams,
headers: { headers: {
Authorization: `Bearer ${accessToken}`, Authorization: `Bearer ${accessToken}`,
'Accept-Encoding': 'application/json'
}, },
} }
); );
@@ -882,6 +896,7 @@ const syncSecretsNetlify = async ({
params: syncParams, params: syncParams,
headers: { headers: {
Authorization: `Bearer ${accessToken}`, Authorization: `Bearer ${accessToken}`,
'Accept-Encoding': 'application/json'
}, },
} }
); );
@@ -1035,6 +1050,7 @@ const syncSecretsRender = async ({
{ {
headers: { headers: {
Authorization: `Bearer ${accessToken}`, Authorization: `Bearer ${accessToken}`,
'Accept-Encoding': 'application/json'
}, },
} }
); );
@@ -1088,6 +1104,7 @@ const syncSecretsFlyio = async ({
method: "post", method: "post",
headers: { headers: {
Authorization: "Bearer " + accessToken, Authorization: "Bearer " + accessToken,
'Accept-Encoding': 'application/json'
}, },
data: { data: {
query: SetSecrets, query: SetSecrets,
@@ -1167,6 +1184,7 @@ const syncSecretsFlyio = async ({
headers: { headers: {
Authorization: "Bearer " + accessToken, Authorization: "Bearer " + accessToken,
"Content-Type": "application/json", "Content-Type": "application/json",
'Accept-Encoding': 'application/json'
}, },
data: { data: {
query: DeleteSecrets, query: DeleteSecrets,