mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 09:26:37 +00:00
Added suffixes to integrations
This commit is contained in:
@@ -30,7 +30,8 @@ export const createIntegration = async (req: Request, res: Response) => {
|
|||||||
owner,
|
owner,
|
||||||
path,
|
path,
|
||||||
region,
|
region,
|
||||||
secretPath
|
secretPath,
|
||||||
|
secretSuffix
|
||||||
} = req.body;
|
} = req.body;
|
||||||
|
|
||||||
const folders = await Folder.findOne({
|
const folders = await Folder.findOne({
|
||||||
@@ -64,6 +65,7 @@ export const createIntegration = async (req: Request, res: Response) => {
|
|||||||
path,
|
path,
|
||||||
region,
|
region,
|
||||||
secretPath,
|
secretPath,
|
||||||
|
secretSuffix,
|
||||||
integration: req.integrationAuth.integration,
|
integration: req.integrationAuth.integration,
|
||||||
integrationAuth: new Types.ObjectId(integrationAuthId)
|
integrationAuth: new Types.ObjectId(integrationAuthId)
|
||||||
}).save();
|
}).save();
|
||||||
|
|||||||
@@ -2066,7 +2066,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) && key.endsWith(integration?.secretSuffix)) {
|
||||||
// delete secret
|
// delete secret
|
||||||
await standardRequest.delete(`${INTEGRATION_CHECKLY_API_URL}/v1/variables/${key}`, {
|
await standardRequest.delete(`${INTEGRATION_CHECKLY_API_URL}/v1/variables/${key}`, {
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ export interface IIntegration {
|
|||||||
path: string;
|
path: string;
|
||||||
region: string;
|
region: string;
|
||||||
secretPath: string;
|
secretPath: string;
|
||||||
|
secretSuffix: string;
|
||||||
integration:
|
integration:
|
||||||
| "azure-key-vault"
|
| "azure-key-vault"
|
||||||
| "aws-parameter-store"
|
| "aws-parameter-store"
|
||||||
@@ -183,6 +184,11 @@ const integrationSchema = new Schema<IIntegration>(
|
|||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
default: "/",
|
default: "/",
|
||||||
|
},
|
||||||
|
secretSuffix: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: "",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,6 +36,14 @@ syncSecretsToThirdPartyServices.process(async (job: Job) => {
|
|||||||
secretPath: integration.secretPath
|
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);
|
const integrationAuth = await IntegrationAuth.findById(integration.integrationAuth);
|
||||||
|
|
||||||
if (!integrationAuth) throw new Error("Failed to find integration auth");
|
if (!integrationAuth) throw new Error("Failed to find integration auth");
|
||||||
@@ -49,7 +57,7 @@ syncSecretsToThirdPartyServices.process(async (job: Job) => {
|
|||||||
await syncSecrets({
|
await syncSecrets({
|
||||||
integration,
|
integration,
|
||||||
integrationAuth,
|
integrationAuth,
|
||||||
secrets,
|
secrets: Object.keys(suffixedSecrets).length !== 0 ? suffixedSecrets : secrets,
|
||||||
accessId: access.accessId === undefined ? null : access.accessId,
|
accessId: access.accessId === undefined ? null : access.accessId,
|
||||||
accessToken: access.accessToken
|
accessToken: access.accessToken
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ router.post(
|
|||||||
body("isActive").exists().isBoolean(),
|
body("isActive").exists().isBoolean(),
|
||||||
body("appId").trim(),
|
body("appId").trim(),
|
||||||
body("secretPath").default("/").isString().trim(),
|
body("secretPath").default("/").isString().trim(),
|
||||||
|
body("secretSuffix").default("").isString().trim(),
|
||||||
body("sourceEnvironment").trim(),
|
body("sourceEnvironment").trim(),
|
||||||
body("targetEnvironment").trim(),
|
body("targetEnvironment").trim(),
|
||||||
body("targetEnvironmentId").trim(),
|
body("targetEnvironmentId").trim(),
|
||||||
|
|||||||
@@ -35,3 +35,9 @@ Select which Infisical environment secrets you want to sync to Checkly and press
|
|||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
<Info>
|
||||||
|
In the new version of the Checkly integration, you are able to specify suffixes that depend on the secrets' environment and path.
|
||||||
|
If you choose to do so, you should utilize such suffixes for ALL Checkly integrations – otherwise the integration system
|
||||||
|
might run into issues with deleting secrets from the wrong environments.
|
||||||
|
</Info>
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ export const useCreateIntegration = () => {
|
|||||||
owner,
|
owner,
|
||||||
path,
|
path,
|
||||||
region,
|
region,
|
||||||
secretPath
|
secretPath,
|
||||||
|
secretSuffix
|
||||||
}: {
|
}: {
|
||||||
integrationAuthId: string;
|
integrationAuthId: string;
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
@@ -55,6 +56,7 @@ export const useCreateIntegration = () => {
|
|||||||
owner: string | null;
|
owner: string | null;
|
||||||
path: string | null;
|
path: string | null;
|
||||||
region: string | null;
|
region: string | null;
|
||||||
|
secretSuffix: string;
|
||||||
}) => {
|
}) => {
|
||||||
const { data: { integration } } = await apiRequest.post("/api/v1/integration", {
|
const { data: { integration } } = await apiRequest.post("/api/v1/integration", {
|
||||||
integrationAuthId,
|
integrationAuthId,
|
||||||
@@ -69,7 +71,8 @@ export const useCreateIntegration = () => {
|
|||||||
owner,
|
owner,
|
||||||
path,
|
path,
|
||||||
region,
|
region,
|
||||||
secretPath
|
secretPath,
|
||||||
|
secretSuffix
|
||||||
});
|
});
|
||||||
|
|
||||||
return integration;
|
return integration;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export type TIntegration = {
|
|||||||
integration: string;
|
integration: string;
|
||||||
integrationAuth: string;
|
integrationAuth: string;
|
||||||
secretPath: string;
|
secretPath: string;
|
||||||
|
secretSuffix: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
__v: number;
|
__v: number;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export default function ChecklyCreateIntegrationPage() {
|
|||||||
|
|
||||||
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
|
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
|
||||||
const [secretPath, setSecretPath] = useState("/");
|
const [secretPath, setSecretPath] = useState("/");
|
||||||
|
const [secretSuffix, setSecretSuffix] = useState("");
|
||||||
|
|
||||||
const [targetApp, setTargetApp] = useState("");
|
const [targetApp, setTargetApp] = useState("");
|
||||||
const [targetAppId, setTargetAppId] = useState("");
|
const [targetAppId, setTargetAppId] = useState("");
|
||||||
@@ -78,7 +79,8 @@ export default function ChecklyCreateIntegrationPage() {
|
|||||||
owner: null,
|
owner: null,
|
||||||
path: null,
|
path: null,
|
||||||
region: null,
|
region: null,
|
||||||
secretPath
|
secretPath,
|
||||||
|
secretSuffix
|
||||||
});
|
});
|
||||||
|
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
@@ -148,6 +150,13 @@ export default function ChecklyCreateIntegrationPage() {
|
|||||||
)}
|
)}
|
||||||
</Select>
|
</Select>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
<FormControl label="Append the Secret Name with..." className="mt-4 px-6">
|
||||||
|
<Input
|
||||||
|
value={secretSuffix}
|
||||||
|
onChange={(evt) => setSecretSuffix(evt.target.value)}
|
||||||
|
placeholder="Provide a suffix for secret names, default is no suffix"
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
<Button
|
<Button
|
||||||
onClick={handleButtonClick}
|
onClick={handleButtonClick}
|
||||||
color="mineshaft"
|
color="mineshaft"
|
||||||
|
|||||||
+8
@@ -115,6 +115,14 @@ export const IntegrationsSection = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{(integration.integration === "checkly") && (
|
||||||
|
<div className="ml-2 flex flex-col">
|
||||||
|
<FormLabel label="Secret Suffix" />
|
||||||
|
<div className="rounded-md border border-mineshaft-700 bg-mineshaft-900 px-3 py-2 font-inter text-sm text-bunker-200">
|
||||||
|
{integration.secretSuffix || "-"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex cursor-default items-center">
|
<div className="flex cursor-default items-center">
|
||||||
<div className="ml-2 opacity-80 duration-200 hover:opacity-100">
|
<div className="ml-2 opacity-80 duration-200 hover:opacity-100">
|
||||||
|
|||||||
Reference in New Issue
Block a user