mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 12:27:28 +00:00
Added suffixes to integrations
This commit is contained in:
@@ -30,7 +30,8 @@ export const createIntegration = async (req: Request, res: Response) => {
|
||||
owner,
|
||||
path,
|
||||
region,
|
||||
secretPath
|
||||
secretPath,
|
||||
secretSuffix
|
||||
} = req.body;
|
||||
|
||||
const folders = await Folder.findOne({
|
||||
@@ -64,6 +65,7 @@ export const createIntegration = async (req: Request, res: Response) => {
|
||||
path,
|
||||
region,
|
||||
secretPath,
|
||||
secretSuffix,
|
||||
integration: req.integrationAuth.integration,
|
||||
integrationAuth: new Types.ObjectId(integrationAuthId)
|
||||
}).save();
|
||||
|
||||
@@ -2066,7 +2066,7 @@ const syncSecretsCheckly = async ({
|
||||
}
|
||||
|
||||
for await (const key of Object.keys(getSecretsRes)) {
|
||||
if (!(key in secrets)) {
|
||||
if (!(key in secrets) && key.endsWith(integration?.secretSuffix)) {
|
||||
// delete secret
|
||||
await standardRequest.delete(`${INTEGRATION_CHECKLY_API_URL}/v1/variables/${key}`, {
|
||||
headers: {
|
||||
|
||||
@@ -45,6 +45,7 @@ export interface IIntegration {
|
||||
path: string;
|
||||
region: string;
|
||||
secretPath: string;
|
||||
secretSuffix: string;
|
||||
integration:
|
||||
| "azure-key-vault"
|
||||
| "aws-parameter-store"
|
||||
@@ -183,6 +184,11 @@ const integrationSchema = new Schema<IIntegration>(
|
||||
type: String,
|
||||
required: true,
|
||||
default: "/",
|
||||
},
|
||||
secretSuffix: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: "",
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -36,6 +36,14 @@ syncSecretsToThirdPartyServices.process(async (job: Job) => {
|
||||
secretPath: integration.secretPath
|
||||
});
|
||||
|
||||
const suffixedSecrets: any = {};
|
||||
if (integration?.secretSuffix) {
|
||||
for (const key in secrets) {
|
||||
const newKey = key + integration?.secretSuffix;
|
||||
suffixedSecrets[newKey] = secrets[key];
|
||||
}
|
||||
}
|
||||
|
||||
const integrationAuth = await IntegrationAuth.findById(integration.integrationAuth);
|
||||
|
||||
if (!integrationAuth) throw new Error("Failed to find integration auth");
|
||||
@@ -49,7 +57,7 @@ syncSecretsToThirdPartyServices.process(async (job: Job) => {
|
||||
await syncSecrets({
|
||||
integration,
|
||||
integrationAuth,
|
||||
secrets,
|
||||
secrets: Object.keys(suffixedSecrets).length !== 0 ? suffixedSecrets : secrets,
|
||||
accessId: access.accessId === undefined ? null : access.accessId,
|
||||
accessToken: access.accessToken
|
||||
});
|
||||
|
||||
@@ -29,6 +29,7 @@ router.post(
|
||||
body("isActive").exists().isBoolean(),
|
||||
body("appId").trim(),
|
||||
body("secretPath").default("/").isString().trim(),
|
||||
body("secretSuffix").default("").isString().trim(),
|
||||
body("sourceEnvironment").trim(),
|
||||
body("targetEnvironment").trim(),
|
||||
body("targetEnvironmentId").trim(),
|
||||
|
||||
Reference in New Issue
Block a user