mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-16 03:31:27 +00:00
Resolve merge conflicts
This commit is contained in:
+143
-143
@@ -1,47 +1,47 @@
|
||||
import _ from 'lodash';
|
||||
import AWS from 'aws-sdk';
|
||||
import _ from "lodash";
|
||||
import AWS from "aws-sdk";
|
||||
import {
|
||||
SecretsManagerClient,
|
||||
UpdateSecretCommand,
|
||||
CreateSecretCommand,
|
||||
CreateSecretCommand,
|
||||
GetSecretValueCommand,
|
||||
ResourceNotFoundException
|
||||
} from '@aws-sdk/client-secrets-manager';
|
||||
ResourceNotFoundException,
|
||||
SecretsManagerClient,
|
||||
UpdateSecretCommand,
|
||||
} from "@aws-sdk/client-secrets-manager";
|
||||
import { Octokit } from "@octokit/rest";
|
||||
import sodium from "libsodium-wrappers";
|
||||
import { IIntegration, IIntegrationAuth } from "../models";
|
||||
import {
|
||||
INTEGRATION_AZURE_KEY_VAULT,
|
||||
INTEGRATION_AWS_PARAMETER_STORE,
|
||||
INTEGRATION_AWS_SECRET_MANAGER,
|
||||
INTEGRATION_HEROKU,
|
||||
INTEGRATION_VERCEL,
|
||||
INTEGRATION_NETLIFY,
|
||||
INTEGRATION_GITHUB,
|
||||
INTEGRATION_GITLAB,
|
||||
INTEGRATION_RENDER,
|
||||
INTEGRATION_RAILWAY,
|
||||
INTEGRATION_FLYIO,
|
||||
INTEGRATION_CIRCLECI,
|
||||
INTEGRATION_TRAVISCI,
|
||||
INTEGRATION_SUPABASE,
|
||||
INTEGRATION_HEROKU_API_URL,
|
||||
INTEGRATION_GITLAB_API_URL,
|
||||
INTEGRATION_VERCEL_API_URL,
|
||||
INTEGRATION_NETLIFY_API_URL,
|
||||
INTEGRATION_RENDER_API_URL,
|
||||
INTEGRATION_RAILWAY_API_URL,
|
||||
INTEGRATION_FLYIO_API_URL,
|
||||
INTEGRATION_CIRCLECI_API_URL,
|
||||
INTEGRATION_TRAVISCI_API_URL,
|
||||
INTEGRATION_SUPABASE_API_URL,
|
||||
INTEGRATION_AZURE_KEY_VAULT,
|
||||
INTEGRATION_CHECKLY,
|
||||
INTEGRATION_CHECKLY_API_URL,
|
||||
INTEGRATION_CIRCLECI,
|
||||
INTEGRATION_CIRCLECI_API_URL,
|
||||
INTEGRATION_FLYIO,
|
||||
INTEGRATION_FLYIO_API_URL,
|
||||
INTEGRATION_GITHUB,
|
||||
INTEGRATION_GITLAB,
|
||||
INTEGRATION_GITLAB_API_URL,
|
||||
INTEGRATION_HASHICORP_VAULT,
|
||||
INTEGRATION_HEROKU,
|
||||
INTEGRATION_HEROKU_API_URL,
|
||||
INTEGRATION_NETLIFY,
|
||||
INTEGRATION_NETLIFY_API_URL,
|
||||
INTEGRATION_RAILWAY,
|
||||
INTEGRATION_RAILWAY_API_URL,
|
||||
INTEGRATION_RENDER,
|
||||
INTEGRATION_RENDER_API_URL,
|
||||
INTEGRATION_SUPABASE,
|
||||
INTEGRATION_SUPABASE_API_URL,
|
||||
INTEGRATION_CLOUDFLARE_PAGES,
|
||||
INTEGRATION_CLOUDFLARE_PAGES_API_URL
|
||||
INTEGRATION_CLOUDFLARE_PAGES_API_URL,
|
||||
INTEGRATION_TRAVISCI,
|
||||
INTEGRATION_TRAVISCI_API_URL,
|
||||
INTEGRATION_VERCEL,
|
||||
INTEGRATION_VERCEL_API_URL,
|
||||
} from "../variables";
|
||||
import { standardRequest} from '../config/request';
|
||||
import { standardRequest} from "../config/request";
|
||||
|
||||
/**
|
||||
* Sync/push [secrets] to [app] in integration named [integration]
|
||||
@@ -70,7 +70,7 @@ const syncSecrets = async ({
|
||||
await syncSecretsAzureKeyVault({
|
||||
integration,
|
||||
secrets,
|
||||
accessToken
|
||||
accessToken,
|
||||
});
|
||||
break;
|
||||
case INTEGRATION_AWS_PARAMETER_STORE:
|
||||
@@ -78,7 +78,7 @@ const syncSecrets = async ({
|
||||
integration,
|
||||
secrets,
|
||||
accessId,
|
||||
accessToken
|
||||
accessToken,
|
||||
});
|
||||
break;
|
||||
case INTEGRATION_AWS_SECRET_MANAGER:
|
||||
@@ -86,7 +86,7 @@ const syncSecrets = async ({
|
||||
integration,
|
||||
secrets,
|
||||
accessId,
|
||||
accessToken
|
||||
accessToken,
|
||||
});
|
||||
break;
|
||||
case INTEGRATION_HEROKU:
|
||||
@@ -137,7 +137,7 @@ const syncSecrets = async ({
|
||||
await syncSecretsRailway({
|
||||
integration,
|
||||
secrets,
|
||||
accessToken
|
||||
accessToken,
|
||||
});
|
||||
break;
|
||||
case INTEGRATION_FLYIO:
|
||||
@@ -165,7 +165,7 @@ const syncSecrets = async ({
|
||||
await syncSecretsSupabase({
|
||||
integration,
|
||||
secrets,
|
||||
accessToken
|
||||
accessToken,
|
||||
});
|
||||
break;
|
||||
case INTEGRATION_FLYIO:
|
||||
@@ -193,7 +193,7 @@ const syncSecrets = async ({
|
||||
await syncSecretsSupabase({
|
||||
integration,
|
||||
secrets,
|
||||
accessToken
|
||||
accessToken,
|
||||
});
|
||||
break;
|
||||
case INTEGRATION_CHECKLY:
|
||||
@@ -209,7 +209,7 @@ const syncSecrets = async ({
|
||||
integrationAuth,
|
||||
secrets,
|
||||
accessId,
|
||||
accessToken
|
||||
accessToken,
|
||||
});
|
||||
break;
|
||||
case INTEGRATION_CLOUDFLARE_PAGES:
|
||||
@@ -233,7 +233,7 @@ const syncSecrets = async ({
|
||||
const syncSecretsAzureKeyVault = async ({
|
||||
integration,
|
||||
secrets,
|
||||
accessToken
|
||||
accessToken,
|
||||
}: {
|
||||
integration: IIntegration;
|
||||
secrets: any;
|
||||
@@ -264,8 +264,8 @@ const syncSecretsAzureKeyVault = async ({
|
||||
while (url) {
|
||||
const res = await standardRequest.get(url, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`
|
||||
}
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
});
|
||||
|
||||
result = result.concat(res.data.value);
|
||||
@@ -281,13 +281,13 @@ const syncSecretsAzureKeyVault = async ({
|
||||
let lastSlashIndex: number;
|
||||
const res = (await Promise.all(getAzureKeyVaultSecrets.map(async (getAzureKeyVaultSecret) => {
|
||||
if (!lastSlashIndex) {
|
||||
lastSlashIndex = getAzureKeyVaultSecret.id.lastIndexOf('/');
|
||||
lastSlashIndex = getAzureKeyVaultSecret.id.lastIndexOf("/");
|
||||
}
|
||||
|
||||
const azureKeyVaultSecret = await standardRequest.get(`${getAzureKeyVaultSecret.id}?api-version=7.3`, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${accessToken}`
|
||||
}
|
||||
"Authorization": `Bearer ${accessToken}`,
|
||||
},
|
||||
});
|
||||
|
||||
return ({
|
||||
@@ -297,7 +297,7 @@ const syncSecretsAzureKeyVault = async ({
|
||||
})))
|
||||
.reduce((obj: any, secret: any) => ({
|
||||
...obj,
|
||||
[secret.key]: secret
|
||||
[secret.key]: secret,
|
||||
}), {});
|
||||
|
||||
const setSecrets: {
|
||||
@@ -306,19 +306,19 @@ const syncSecretsAzureKeyVault = async ({
|
||||
}[] = [];
|
||||
|
||||
Object.keys(secrets).forEach((key) => {
|
||||
const hyphenatedKey = key.replace(/_/g, '-');
|
||||
const hyphenatedKey = key.replace(/_/g, "-");
|
||||
if (!(hyphenatedKey in res)) {
|
||||
// case: secret has been created
|
||||
setSecrets.push({
|
||||
key: hyphenatedKey,
|
||||
value: secrets[key]
|
||||
value: secrets[key],
|
||||
});
|
||||
} else {
|
||||
if (secrets[key] !== res[hyphenatedKey].value) {
|
||||
// case: secret has been updated
|
||||
setSecrets.push({
|
||||
key: hyphenatedKey,
|
||||
value: secrets[key]
|
||||
value: secrets[key],
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -327,7 +327,7 @@ const syncSecretsAzureKeyVault = async ({
|
||||
const deleteSecrets: AzureKeyVaultSecret[] = [];
|
||||
|
||||
Object.keys(res).forEach((key) => {
|
||||
const underscoredKey = key.replace(/-/g, '_');
|
||||
const underscoredKey = key.replace(/-/g, "_");
|
||||
if (!(underscoredKey in secrets)) {
|
||||
deleteSecrets.push(res[key]);
|
||||
}
|
||||
@@ -337,7 +337,7 @@ const syncSecretsAzureKeyVault = async ({
|
||||
key,
|
||||
value,
|
||||
integration,
|
||||
accessToken
|
||||
accessToken,
|
||||
}: {
|
||||
key: string;
|
||||
value: string;
|
||||
@@ -353,12 +353,12 @@ const syncSecretsAzureKeyVault = async ({
|
||||
await standardRequest.put(
|
||||
`${integration.app}/secrets/${key}?api-version=7.3`,
|
||||
{
|
||||
value
|
||||
value,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`
|
||||
}
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -366,13 +366,13 @@ const syncSecretsAzureKeyVault = async ({
|
||||
|
||||
} catch (err) {
|
||||
const error: any = err;
|
||||
if (error?.response?.data?.error?.innererror?.code === 'ObjectIsDeletedButRecoverable') {
|
||||
if (error?.response?.data?.error?.innererror?.code === "ObjectIsDeletedButRecoverable") {
|
||||
await standardRequest.post(
|
||||
`${integration.app}/deletedsecrets/${key}/recover?api-version=7.3`, {},
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`
|
||||
}
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
await new Promise(resolve => setTimeout(resolve, 10000));
|
||||
@@ -391,7 +391,7 @@ const syncSecretsAzureKeyVault = async ({
|
||||
key,
|
||||
value,
|
||||
integration,
|
||||
accessToken
|
||||
accessToken,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -399,8 +399,8 @@ const syncSecretsAzureKeyVault = async ({
|
||||
const { key } = deleteSecret;
|
||||
await standardRequest.delete(`${integration.app}/secrets/${key}?api-version=7.3`, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${accessToken}`
|
||||
}
|
||||
"Authorization": `Bearer ${accessToken}`,
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -417,7 +417,7 @@ const syncSecretsAWSParameterStore = async ({
|
||||
integration,
|
||||
secrets,
|
||||
accessId,
|
||||
accessToken
|
||||
accessToken,
|
||||
}: {
|
||||
integration: IIntegration;
|
||||
secrets: any;
|
||||
@@ -429,18 +429,18 @@ const syncSecretsAWSParameterStore = async ({
|
||||
AWS.config.update({
|
||||
region: integration.region,
|
||||
accessKeyId: accessId,
|
||||
secretAccessKey: accessToken
|
||||
secretAccessKey: accessToken,
|
||||
});
|
||||
|
||||
const ssm = new AWS.SSM({
|
||||
apiVersion: '2014-11-06',
|
||||
region: integration.region
|
||||
apiVersion: "2014-11-06",
|
||||
region: integration.region,
|
||||
});
|
||||
|
||||
const params = {
|
||||
Path: integration.path,
|
||||
Recursive: true,
|
||||
WithDecryption: true
|
||||
WithDecryption: true,
|
||||
};
|
||||
|
||||
const parameterList = (await ssm.getParametersByPath(params).promise()).Parameters
|
||||
@@ -452,7 +452,7 @@ const syncSecretsAWSParameterStore = async ({
|
||||
if (parameterList) {
|
||||
awsParameterStoreSecretsObj = parameterList.reduce((obj: any, secret: any) => ({
|
||||
...obj,
|
||||
[secret.Name.split("/").pop()]: secret
|
||||
[secret.Name.split("/").pop()]: secret,
|
||||
}), {});
|
||||
}
|
||||
|
||||
@@ -463,9 +463,9 @@ const syncSecretsAWSParameterStore = async ({
|
||||
// -> create secret
|
||||
await ssm.putParameter({
|
||||
Name: `${integration.path}${key}`,
|
||||
Type: 'SecureString',
|
||||
Type: "SecureString",
|
||||
Value: secrets[key],
|
||||
Overwrite: true
|
||||
Overwrite: true,
|
||||
}).promise();
|
||||
} else {
|
||||
// case: secret exists in AWS parameter store
|
||||
@@ -475,9 +475,9 @@ const syncSecretsAWSParameterStore = async ({
|
||||
// -> update secret
|
||||
await ssm.putParameter({
|
||||
Name: `${integration.path}${key}`,
|
||||
Type: 'SecureString',
|
||||
Type: "SecureString",
|
||||
Value: secrets[key],
|
||||
Overwrite: true
|
||||
Overwrite: true,
|
||||
}).promise();
|
||||
}
|
||||
}
|
||||
@@ -489,7 +489,7 @@ const syncSecretsAWSParameterStore = async ({
|
||||
// case:
|
||||
// -> delete secret
|
||||
await ssm.deleteParameter({
|
||||
Name: awsParameterStoreSecretsObj[key].Name
|
||||
Name: awsParameterStoreSecretsObj[key].Name,
|
||||
}).promise();
|
||||
}
|
||||
});
|
||||
@@ -497,7 +497,7 @@ const syncSecretsAWSParameterStore = async ({
|
||||
AWS.config.update({
|
||||
region: undefined,
|
||||
accessKeyId: undefined,
|
||||
secretAccessKey: undefined
|
||||
secretAccessKey: undefined,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -513,7 +513,7 @@ const syncSecretsAWSSecretManager = async ({
|
||||
integration,
|
||||
secrets,
|
||||
accessId,
|
||||
accessToken
|
||||
accessToken,
|
||||
}: {
|
||||
integration: IIntegration;
|
||||
secrets: any;
|
||||
@@ -527,20 +527,20 @@ const syncSecretsAWSSecretManager = async ({
|
||||
AWS.config.update({
|
||||
region: integration.region,
|
||||
accessKeyId: accessId,
|
||||
secretAccessKey: accessToken
|
||||
secretAccessKey: accessToken,
|
||||
});
|
||||
|
||||
secretsManager = new SecretsManagerClient({
|
||||
region: integration.region,
|
||||
credentials: {
|
||||
accessKeyId: accessId,
|
||||
secretAccessKey: accessToken
|
||||
}
|
||||
secretAccessKey: accessToken,
|
||||
},
|
||||
});
|
||||
|
||||
const awsSecretManagerSecret = await secretsManager.send(
|
||||
new GetSecretValueCommand({
|
||||
SecretId: integration.app
|
||||
SecretId: integration.app,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -553,26 +553,26 @@ const syncSecretsAWSSecretManager = async ({
|
||||
if (!_.isEqual(awsSecretManagerSecretObj, secrets)) {
|
||||
await secretsManager.send(new UpdateSecretCommand({
|
||||
SecretId: integration.app,
|
||||
SecretString: JSON.stringify(secrets)
|
||||
SecretString: JSON.stringify(secrets),
|
||||
}));
|
||||
}
|
||||
|
||||
AWS.config.update({
|
||||
region: undefined,
|
||||
accessKeyId: undefined,
|
||||
secretAccessKey: undefined
|
||||
secretAccessKey: undefined,
|
||||
});
|
||||
} catch (err) {
|
||||
if (err instanceof ResourceNotFoundException && secretsManager) {
|
||||
await secretsManager.send(new CreateSecretCommand({
|
||||
Name: integration.app,
|
||||
SecretString: JSON.stringify(secrets)
|
||||
SecretString: JSON.stringify(secrets),
|
||||
}));
|
||||
}
|
||||
AWS.config.update({
|
||||
region: undefined,
|
||||
accessKeyId: undefined,
|
||||
secretAccessKey: undefined
|
||||
secretAccessKey: undefined,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -600,7 +600,7 @@ const syncSecretsHeroku = async ({
|
||||
headers: {
|
||||
Accept: "application/vnd.heroku+json; version=3",
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Accept-Encoding': 'application/json'
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -619,7 +619,7 @@ const syncSecretsHeroku = async ({
|
||||
headers: {
|
||||
Accept: "application/vnd.heroku+json; version=3",
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Accept-Encoding': 'application/json'
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
@@ -667,8 +667,8 @@ const syncSecretsVercel = async ({
|
||||
params,
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Accept-Encoding': 'application/json'
|
||||
}
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
))
|
||||
.data
|
||||
@@ -679,7 +679,7 @@ const syncSecretsVercel = async ({
|
||||
return false;
|
||||
}
|
||||
|
||||
if (integration.targetEnvironment === 'preview' && integration.path && integration.path !== secret.gitBranch) {
|
||||
if (integration.targetEnvironment === "preview" && integration.path && integration.path !== secret.gitBranch) {
|
||||
// case: secret on preview environment does not have same target git branch
|
||||
return false;
|
||||
}
|
||||
@@ -692,7 +692,7 @@ const syncSecretsVercel = async ({
|
||||
const res: { [key: string]: VercelSecret } = {};
|
||||
|
||||
for await (const vercelSecret of vercelSecrets) {
|
||||
if (vercelSecret.type === 'encrypted') {
|
||||
if (vercelSecret.type === "encrypted") {
|
||||
// case: secret is encrypted -> need to decrypt
|
||||
const decryptedSecret = (await standardRequest.get(
|
||||
`${INTEGRATION_VERCEL_API_URL}/v9/projects/${integration.app}/env/${vercelSecret.id}`,
|
||||
@@ -700,8 +700,8 @@ const syncSecretsVercel = async ({
|
||||
params,
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Accept-Encoding': 'application/json'
|
||||
}
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
)).data;
|
||||
|
||||
@@ -725,8 +725,8 @@ const syncSecretsVercel = async ({
|
||||
type: "encrypted",
|
||||
target: [integration.targetEnvironment],
|
||||
...(integration.path ? {
|
||||
gitBranch: integration.path
|
||||
} : {})
|
||||
gitBranch: integration.path,
|
||||
} : {}),
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -745,8 +745,8 @@ const syncSecretsVercel = async ({
|
||||
? [...res[key].target]
|
||||
: [...res[key].target, integration.targetEnvironment],
|
||||
...(integration.path ? {
|
||||
gitBranch: integration.path
|
||||
} : {})
|
||||
gitBranch: integration.path,
|
||||
} : {}),
|
||||
});
|
||||
}
|
||||
} else {
|
||||
@@ -758,8 +758,8 @@ const syncSecretsVercel = async ({
|
||||
type: "encrypted", // value doesn't matter
|
||||
target: [integration.targetEnvironment],
|
||||
...(integration.path ? {
|
||||
gitBranch: integration.path
|
||||
} : {})
|
||||
gitBranch: integration.path,
|
||||
} : {}),
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -773,14 +773,14 @@ const syncSecretsVercel = async ({
|
||||
params,
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Accept-Encoding': 'application/json'
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
for await (const secret of updateSecrets) {
|
||||
if (secret.type !== 'sensitive') {
|
||||
if (secret.type !== "sensitive") {
|
||||
const { id, ...updatedSecret } = secret;
|
||||
await standardRequest.patch(
|
||||
`${INTEGRATION_VERCEL_API_URL}/v9/projects/${integration.app}/env/${secret.id}`,
|
||||
@@ -789,7 +789,7 @@ const syncSecretsVercel = async ({
|
||||
params,
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Accept-Encoding': 'application/json'
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
@@ -803,7 +803,7 @@ const syncSecretsVercel = async ({
|
||||
params,
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Accept-Encoding': 'application/json'
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
@@ -856,7 +856,7 @@ const syncSecretsNetlify = async ({
|
||||
params: getParams,
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Accept-Encoding': 'application/json'
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -971,7 +971,7 @@ const syncSecretsNetlify = async ({
|
||||
params: syncParams,
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Accept-Encoding': 'application/json'
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
@@ -989,7 +989,7 @@ const syncSecretsNetlify = async ({
|
||||
params: syncParams,
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Accept-Encoding': 'application/json'
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
@@ -1004,7 +1004,7 @@ const syncSecretsNetlify = async ({
|
||||
params: syncParams,
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Accept-Encoding': 'application/json'
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
@@ -1019,7 +1019,7 @@ const syncSecretsNetlify = async ({
|
||||
params: syncParams,
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Accept-Encoding': 'application/json'
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
@@ -1071,7 +1071,7 @@ const syncSecretsGitHub = async ({
|
||||
"GET /repos/{owner}/{repo}/actions/secrets/public-key",
|
||||
{
|
||||
owner: integration.owner,
|
||||
repo: integration.app
|
||||
repo: integration.app,
|
||||
}
|
||||
)
|
||||
).data;
|
||||
@@ -1161,7 +1161,7 @@ const syncSecretsRender = async ({
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Accept-Encoding': 'application/json'
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
@@ -1177,7 +1177,7 @@ const syncSecretsRender = async ({
|
||||
const syncSecretsRailway = async ({
|
||||
integration,
|
||||
secrets,
|
||||
accessToken
|
||||
accessToken,
|
||||
}: {
|
||||
integration: IIntegration;
|
||||
secrets: any;
|
||||
@@ -1194,7 +1194,7 @@ const syncSecretsRailway = async ({
|
||||
environmentId: integration.targetEnvironmentId,
|
||||
...(integration.targetServiceId ? { serviceId: integration.targetServiceId } : {}),
|
||||
replace: true,
|
||||
variables: secrets
|
||||
variables: secrets,
|
||||
};
|
||||
|
||||
await standardRequest.post(INTEGRATION_RAILWAY_API_URL, {
|
||||
@@ -1204,9 +1204,9 @@ const syncSecretsRailway = async ({
|
||||
},
|
||||
}, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${accessToken}`,
|
||||
'Content-Type': 'application/json',
|
||||
'Accept-Encoding': 'application/json'
|
||||
"Authorization": `Bearer ${accessToken}`,
|
||||
"Content-Type": "application/json",
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1262,7 +1262,7 @@ const syncSecretsFlyio = async ({
|
||||
}, {
|
||||
headers: {
|
||||
Authorization: "Bearer " + accessToken,
|
||||
'Accept-Encoding': 'application/json',
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1291,8 +1291,8 @@ const syncSecretsFlyio = async ({
|
||||
}, {
|
||||
headers: {
|
||||
Authorization: "Bearer " + accessToken,
|
||||
'Content-Type': 'application/json',
|
||||
'Accept-Encoding': 'application/json',
|
||||
"Content-Type": "application/json",
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
})).data.data.app.secrets;
|
||||
|
||||
@@ -1331,7 +1331,7 @@ const syncSecretsFlyio = async ({
|
||||
headers: {
|
||||
Authorization: "Bearer " + accessToken,
|
||||
"Content-Type": "application/json",
|
||||
'Accept-Encoding': 'application/json',
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -1442,7 +1442,7 @@ const syncSecretsTravisCI = async ({
|
||||
?.env_vars
|
||||
.reduce((obj: any, secret: any) => ({
|
||||
...obj,
|
||||
[secret.name]: secret
|
||||
[secret.name]: secret,
|
||||
}), {});
|
||||
|
||||
// add secrets
|
||||
@@ -1455,8 +1455,8 @@ const syncSecretsTravisCI = async ({
|
||||
{
|
||||
env_var: {
|
||||
name: key,
|
||||
value: secrets[key]
|
||||
}
|
||||
value: secrets[key],
|
||||
},
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
@@ -1475,7 +1475,7 @@ const syncSecretsTravisCI = async ({
|
||||
env_var: {
|
||||
name: key,
|
||||
value: secrets[key],
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
@@ -1543,10 +1543,10 @@ const syncSecretsGitLab = async ({
|
||||
allEnvVariables = [...allEnvVariables, ...response.data];
|
||||
|
||||
const linkHeader = response.headers.link;
|
||||
const nextLink = linkHeader?.split(',').find((part: string) => part.includes('rel="next"'));
|
||||
const nextLink = linkHeader?.split(",").find((part: string) => part.includes('rel="next"'));
|
||||
|
||||
if (nextLink) {
|
||||
url = nextLink.trim().split(';')[0].slice(1, -1);
|
||||
url = nextLink.trim().split(";")[0].slice(1, -1);
|
||||
} else {
|
||||
url = null;
|
||||
}
|
||||
@@ -1571,7 +1571,7 @@ const syncSecretsGitLab = async ({
|
||||
protected: false,
|
||||
masked: false,
|
||||
raw: false,
|
||||
environment_scope: integration.targetEnvironment
|
||||
environment_scope: integration.targetEnvironment,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
@@ -1588,7 +1588,7 @@ const syncSecretsGitLab = async ({
|
||||
`${INTEGRATION_GITLAB_API_URL}/v4/projects/${integration?.appId}/variables/${existingSecret.key}?filter[environment_scope]=${integration.targetEnvironment}`,
|
||||
{
|
||||
...existingSecret,
|
||||
value: secrets[existingSecret.key]
|
||||
value: secrets[existingSecret.key],
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
@@ -1628,7 +1628,7 @@ const syncSecretsGitLab = async ({
|
||||
const syncSecretsSupabase = async ({
|
||||
integration,
|
||||
secrets,
|
||||
accessToken
|
||||
accessToken,
|
||||
}: {
|
||||
integration: IIntegration;
|
||||
secrets: any;
|
||||
@@ -1639,8 +1639,8 @@ const syncSecretsSupabase = async ({
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Accept-Encoding': 'application/json'
|
||||
}
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1649,7 +1649,7 @@ const syncSecretsSupabase = async ({
|
||||
(key) => {
|
||||
return {
|
||||
name: key,
|
||||
value: secrets[key]
|
||||
value: secrets[key],
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -1660,8 +1660,8 @@ const syncSecretsSupabase = async ({
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Accept-Encoding': 'application/json'
|
||||
}
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1677,10 +1677,10 @@ const syncSecretsSupabase = async ({
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Content-Type': 'application/json',
|
||||
'Accept-Encoding': 'application/json'
|
||||
"Content-Type": "application/json",
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
data: secretsToDelete
|
||||
data: secretsToDelete,
|
||||
}
|
||||
);
|
||||
};
|
||||
@@ -1710,7 +1710,7 @@ const syncSecretsCheckly = async ({
|
||||
headers: {
|
||||
"Authorization": `Bearer ${accessToken}`,
|
||||
"Accept-Encoding": "application/json",
|
||||
"X-Checkly-Account": integration.appId
|
||||
"X-Checkly-Account": integration.appId,
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -1718,7 +1718,7 @@ const syncSecretsCheckly = async ({
|
||||
.data
|
||||
.reduce((obj: any, secret: any) => ({
|
||||
...obj,
|
||||
[secret.key]: secret.value
|
||||
[secret.key]: secret.value,
|
||||
}), {});
|
||||
|
||||
// add secrets
|
||||
@@ -1731,14 +1731,14 @@ const syncSecretsCheckly = async ({
|
||||
`${INTEGRATION_CHECKLY_API_URL}/v1/variables`,
|
||||
{
|
||||
key,
|
||||
value: secrets[key]
|
||||
value: secrets[key],
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
"Authorization": `Bearer ${accessToken}`,
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"X-Checkly-Account": integration.appId
|
||||
"X-Checkly-Account": integration.appId,
|
||||
},
|
||||
}
|
||||
);
|
||||
@@ -1750,14 +1750,14 @@ const syncSecretsCheckly = async ({
|
||||
await standardRequest.put(
|
||||
`${INTEGRATION_CHECKLY_API_URL}/v1/variables/${key}`,
|
||||
{
|
||||
value: secrets[key]
|
||||
value: secrets[key],
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
"Authorization": `Bearer ${accessToken}`,
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json",
|
||||
"X-Checkly-Account": integration.appId
|
||||
"X-Checkly-Account": integration.appId,
|
||||
},
|
||||
}
|
||||
);
|
||||
@@ -1774,7 +1774,7 @@ const syncSecretsCheckly = async ({
|
||||
headers: {
|
||||
"Authorization": `Bearer ${accessToken}`,
|
||||
"Accept": "application/json",
|
||||
"X-Checkly-Account": integration.appId
|
||||
"X-Checkly-Account": integration.appId,
|
||||
},
|
||||
}
|
||||
);
|
||||
@@ -1815,12 +1815,12 @@ const syncSecretsHashiCorpVault = async ({
|
||||
`${integrationAuth.url}/v1/auth/approle/login`,
|
||||
{
|
||||
"role_id": accessId,
|
||||
"secret_id": accessToken
|
||||
"secret_id": accessToken,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
"X-Vault-Namespace": integrationAuth.namespace
|
||||
}
|
||||
"X-Vault-Namespace": integrationAuth.namespace,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1829,7 +1829,7 @@ const syncSecretsHashiCorpVault = async ({
|
||||
await standardRequest.post(
|
||||
`${integrationAuth.url}/v1/${integration.app}/data/${integration.path}`,
|
||||
{
|
||||
data: secrets
|
||||
data: secrets,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
@@ -1837,7 +1837,7 @@ const syncSecretsHashiCorpVault = async ({
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"X-Vault-Token": clientToken,
|
||||
"X-Vault-Namespace": integrationAuth.namespace
|
||||
"X-Vault-Namespace": integrationAuth.namespace,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user