mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 19:28:09 +00:00
fix: requested changes
This commit is contained in:
@@ -1126,8 +1126,7 @@ export const INTEGRATION = {
|
|||||||
shouldAutoRedeploy: "Used by Render to trigger auto deploy.",
|
shouldAutoRedeploy: "Used by Render to trigger auto deploy.",
|
||||||
secretGCPLabel: "The label for GCP secrets.",
|
secretGCPLabel: "The label for GCP secrets.",
|
||||||
secretAWSTag: "The tags for AWS secrets.",
|
secretAWSTag: "The tags for AWS secrets.",
|
||||||
azureUseLabels:
|
azureLabel: "Define which label to assign to secrets created in Azure App Configuration.",
|
||||||
"If enabled, each secret will be given a label that represents which Infisical environment they belong to.",
|
|
||||||
githubVisibility:
|
githubVisibility:
|
||||||
"Define where the secrets from the Github Integration should be visible. Option 'selected' lets you directly define which repositories to sync secrets to.",
|
"Define where the secrets from the Github Integration should be visible. Option 'selected' lets you directly define which repositories to sync secrets to.",
|
||||||
githubVisibilityRepoIds:
|
githubVisibilityRepoIds:
|
||||||
|
|||||||
@@ -422,9 +422,9 @@ const syncSecretsAzureAppConfig = async ({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
...(metadata.azureUseLabels && {
|
...(metadata.azureLabel && {
|
||||||
params: {
|
params: {
|
||||||
label: integration.environment.slug
|
label: metadata.azureLabel
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@@ -447,9 +447,9 @@ const syncSecretsAzureAppConfig = async ({
|
|||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`
|
Authorization: `Bearer ${accessToken}`
|
||||||
},
|
},
|
||||||
...(metadata.azureUseLabels && {
|
...(metadata.azureLabel && {
|
||||||
params: {
|
params: {
|
||||||
label: integration.environment.slug
|
label: metadata.azureLabel
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
// we force IPV4 because docker setup fails with ipv6
|
// we force IPV4 because docker setup fails with ipv6
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export const IntegrationMetadataSchema = z.object({
|
|||||||
.optional()
|
.optional()
|
||||||
.describe(INTEGRATION.CREATE.metadata.secretAWSTag),
|
.describe(INTEGRATION.CREATE.metadata.secretAWSTag),
|
||||||
|
|
||||||
azureUseLabels: z.boolean().optional().describe(INTEGRATION.CREATE.metadata.azureUseLabels),
|
azureLabel: z.string().optional().describe(INTEGRATION.CREATE.metadata.azureLabel),
|
||||||
|
|
||||||
githubVisibility: z
|
githubVisibility: z
|
||||||
.union([z.literal("selected"), z.literal("private"), z.literal("all")])
|
.union([z.literal("selected"), z.literal("private"), z.literal("all")])
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export const useCreateIntegration = () => {
|
|||||||
key: string;
|
key: string;
|
||||||
value: string;
|
value: string;
|
||||||
}[];
|
}[];
|
||||||
azureUseLabels?: boolean;
|
azureLabel?: string;
|
||||||
githubVisibility?: string;
|
githubVisibility?: string;
|
||||||
githubVisibilityRepoIds?: string[];
|
githubVisibilityRepoIds?: string[];
|
||||||
kmsKeyId?: string;
|
kmsKeyId?: string;
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ export type TIntegration = {
|
|||||||
key: string;
|
key: string;
|
||||||
value: string;
|
value: string;
|
||||||
}[];
|
}[];
|
||||||
|
azureLabel?: string;
|
||||||
|
|
||||||
kmsKeyId?: string;
|
kmsKeyId?: string;
|
||||||
secretSuffix?: string;
|
secretSuffix?: string;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
|||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
|
import { createNotification } from "@app/components/notifications";
|
||||||
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
|
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
|
||||||
import { useCreateIntegration } from "@app/hooks/api";
|
import { useCreateIntegration } from "@app/hooks/api";
|
||||||
import { IntegrationSyncBehavior } from "@app/hooks/api/integrations/types";
|
import { IntegrationSyncBehavior } from "@app/hooks/api/integrations/types";
|
||||||
@@ -46,7 +47,8 @@ const schema = z.object({
|
|||||||
sourceEnvironment: z.string().trim().min(1, { message: "Source environment is required" }),
|
sourceEnvironment: z.string().trim().min(1, { message: "Source environment is required" }),
|
||||||
initialSyncBehavior: z.nativeEnum(IntegrationSyncBehavior),
|
initialSyncBehavior: z.nativeEnum(IntegrationSyncBehavior),
|
||||||
secretPrefix: z.string().default(""),
|
secretPrefix: z.string().default(""),
|
||||||
useLabels: z.boolean().default(false)
|
useLabels: z.boolean().default(false),
|
||||||
|
azureLabel: z.string().min(1).optional()
|
||||||
});
|
});
|
||||||
|
|
||||||
type TFormSchema = z.infer<typeof schema>;
|
type TFormSchema = z.infer<typeof schema>;
|
||||||
@@ -93,7 +95,7 @@ export default function AzureAppConfigurationCreateIntegration() {
|
|||||||
}
|
}
|
||||||
}, [workspace]);
|
}, [workspace]);
|
||||||
|
|
||||||
const sourceEnv = watch("sourceEnvironment");
|
const shouldUseLabels = watch("useLabels");
|
||||||
|
|
||||||
const handleIntegrationSubmit = async ({
|
const handleIntegrationSubmit = async ({
|
||||||
secretPath,
|
secretPath,
|
||||||
@@ -101,11 +103,20 @@ export default function AzureAppConfigurationCreateIntegration() {
|
|||||||
sourceEnvironment,
|
sourceEnvironment,
|
||||||
baseUrl,
|
baseUrl,
|
||||||
initialSyncBehavior,
|
initialSyncBehavior,
|
||||||
secretPrefix
|
secretPrefix,
|
||||||
|
azureLabel
|
||||||
}: TFormSchema) => {
|
}: TFormSchema) => {
|
||||||
try {
|
try {
|
||||||
if (!integrationAuth?.id) return;
|
if (!integrationAuth?.id) return;
|
||||||
|
|
||||||
|
if (useLabels && !azureLabel) {
|
||||||
|
createNotification({
|
||||||
|
type: "error",
|
||||||
|
text: "Label must be provided when 'Use Labels' is enabled"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?.id,
|
integrationAuthId: integrationAuth?.id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
@@ -115,7 +126,7 @@ export default function AzureAppConfigurationCreateIntegration() {
|
|||||||
metadata: {
|
metadata: {
|
||||||
initialSyncBehavior,
|
initialSyncBehavior,
|
||||||
secretPrefix,
|
secretPrefix,
|
||||||
azureUseLabels: useLabels
|
...(useLabels && { azureLabel })
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -167,7 +178,7 @@ export default function AzureAppConfigurationCreateIntegration() {
|
|||||||
</div>
|
</div>
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
<div className="px-6">
|
<div className="px-6">
|
||||||
<div className="mb-2 -space-y-2">
|
<div className="">
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="sourceEnvironment"
|
name="sourceEnvironment"
|
||||||
@@ -198,43 +209,43 @@ export default function AzureAppConfigurationCreateIntegration() {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Controller
|
<div className="flex w-full flex-col gap-1">
|
||||||
control={control}
|
<Controller
|
||||||
name="useLabels"
|
control={control}
|
||||||
render={({ field: { onChange, value } }) => (
|
name="useLabels"
|
||||||
<Switch
|
render={({ field: { onChange, value } }) => (
|
||||||
id="use-environment-labels"
|
<Switch
|
||||||
onCheckedChange={(isChecked) => onChange(isChecked)}
|
id="use-environment-labels"
|
||||||
isChecked={value}
|
onCheckedChange={(isChecked) => onChange(isChecked)}
|
||||||
>
|
isChecked={value}
|
||||||
<div className="flex items-center gap-1">
|
>
|
||||||
Use Environment Labels
|
<div className="flex w-full items-center gap-1">
|
||||||
<Tooltip
|
Use Labels
|
||||||
content={
|
<Tooltip content="Assign a label to each key-value pair that gets synced to your Azure App Configuration.">
|
||||||
<div>
|
<FontAwesomeIcon icon={faQuestionCircle} size="1x" />
|
||||||
<p>
|
</Tooltip>
|
||||||
Use the environment slug as the label on the secret keys created in
|
</div>
|
||||||
Azure App Configuration.
|
</Switch>
|
||||||
<br />
|
)}
|
||||||
<br />
|
/>
|
||||||
{sourceEnv && (
|
|
||||||
<p>
|
{shouldUseLabels && (
|
||||||
You have selected the{" "}
|
<Controller
|
||||||
<span className="font-semibold">{sourceEnv}</span> environment,
|
control={control}
|
||||||
therefore the label will be set to{" "}
|
name="azureLabel"
|
||||||
<span className="font-semibold">{sourceEnv}</span>.
|
render={({ field, fieldState: { error } }) => (
|
||||||
</p>
|
<FormControl
|
||||||
)}
|
className=""
|
||||||
</p>
|
// label="Label"
|
||||||
</div>
|
errorText={error?.message}
|
||||||
}
|
isError={Boolean(error)}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon icon={faQuestionCircle} size="1x" />
|
<Input {...field} placeholder="pre-prod" />
|
||||||
</Tooltip>
|
</FormControl>
|
||||||
</div>
|
)}
|
||||||
</Switch>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
|
|||||||
+2
-1
@@ -14,6 +14,7 @@ const metadataMappings: Record<keyof NonNullable<TIntegrationWithEnv["metadata"]
|
|||||||
githubVisibilityRepoIds: "Github Visibility Repo Ids",
|
githubVisibilityRepoIds: "Github Visibility Repo Ids",
|
||||||
shouldAutoRedeploy: "Auto Redeploy Target Application When Secrets Change",
|
shouldAutoRedeploy: "Auto Redeploy Target Application When Secrets Change",
|
||||||
secretAWSTag: "Tags For Secrets Stored In AWS",
|
secretAWSTag: "Tags For Secrets Stored In AWS",
|
||||||
|
azureLabel: "Azure Label",
|
||||||
kmsKeyId: "AWS KMS Key ID",
|
kmsKeyId: "AWS KMS Key ID",
|
||||||
secretSuffix: "Secret Suffix",
|
secretSuffix: "Secret Suffix",
|
||||||
secretPrefix: "Secret Prefix",
|
secretPrefix: "Secret Prefix",
|
||||||
@@ -86,7 +87,7 @@ export const IntegrationSettingsSection = ({ integration }: Props) => {
|
|||||||
Object.entries(integration.metadata).map(([key, value]) => (
|
Object.entries(integration.metadata).map(([key, value]) => (
|
||||||
<div key={key} className="flex flex-col">
|
<div key={key} className="flex flex-col">
|
||||||
<p className="text-sm text-gray-400">
|
<p className="text-sm text-gray-400">
|
||||||
{metadataMappings[key as keyof typeof metadataMappings]}
|
{!!value && metadataMappings[key as keyof typeof metadataMappings]}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-sm text-gray-200">{renderValue(key as MetadataKey, value)}</p>
|
<p className="text-sm text-gray-200">{renderValue(key as MetadataKey, value)}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user