Merge pull request #629 from Infisical/optimize-checkly

Optimize Checkly integration
This commit is contained in:
BlackMagiq
2023-06-08 11:21:28 +01:00
committed by GitHub
+6 -2
View File
@@ -1706,11 +1706,12 @@ const syncSecretsCheckly = async ({
if (!(key in getSecretsRes)) { if (!(key in getSecretsRes)) {
// case: secret does not exist in checkly // case: secret does not exist in checkly
// -> add secret // -> add secret
await standardRequest.post( await standardRequest.post(
`${INTEGRATION_CHECKLY_API_URL}/v1/variables`, `${INTEGRATION_CHECKLY_API_URL}/v1/variables`,
{ {
key, key,
value: secrets[key] ? secrets[key] : 'EMPTY' value: secrets[key]
}, },
{ {
headers: { headers: {
@@ -1724,10 +1725,12 @@ const syncSecretsCheckly = async ({
} else { } else {
// case: secret exists in checkly // case: secret exists in checkly
// -> update/set secret // -> update/set secret
if (secrets[key] !== getSecretsRes[key]) {
await standardRequest.put( await standardRequest.put(
`${INTEGRATION_CHECKLY_API_URL}/v1/variables/${key}`, `${INTEGRATION_CHECKLY_API_URL}/v1/variables/${key}`,
{ {
value: secrets[key] ? secrets[key] : 'EMPTY' value: secrets[key]
}, },
{ {
headers: { headers: {
@@ -1740,6 +1743,7 @@ const syncSecretsCheckly = async ({
); );
} }
} }
}
for await (const key of Object.keys(getSecretsRes)) { for await (const key of Object.keys(getSecretsRes)) {
if (!(key in secrets)){ if (!(key in secrets)){