mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
add secretGroup to integrationController.ts
This commit is contained in:
@@ -27,7 +27,8 @@ export const createIntegration = async (req: Request, res: Response) => {
|
||||
owner,
|
||||
path,
|
||||
region,
|
||||
secretPath
|
||||
secretPath,
|
||||
secretGroup
|
||||
} = req.body;
|
||||
|
||||
const folders = await Folder.findOne({
|
||||
@@ -61,6 +62,7 @@ export const createIntegration = async (req: Request, res: Response) => {
|
||||
path,
|
||||
region,
|
||||
secretPath,
|
||||
secretGroup,
|
||||
integration: req.integrationAuth.integration,
|
||||
integrationAuth: new Types.ObjectId(integrationAuthId)
|
||||
}).save();
|
||||
|
||||
@@ -2109,6 +2109,7 @@ const syncSecretsCodefresh = async ({
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/* Sync/push [secrets] to Northflank
|
||||
* @param {Object} obj
|
||||
* @param {IIntegration} obj.integration - integration details
|
||||
|
||||
@@ -168,6 +168,7 @@ const integrationSchema = new Schema<IIntegration>(
|
||||
default: "/",
|
||||
},
|
||||
secretGroup: {
|
||||
// northflank-specific service
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
|
||||
@@ -37,6 +37,7 @@ router.post(
|
||||
body("owner").trim(),
|
||||
body("path").trim(),
|
||||
body("region").trim(),
|
||||
body("secretGroup").isString().trim(),
|
||||
validateRequest,
|
||||
integrationController.createIntegration
|
||||
);
|
||||
|
||||
@@ -22,7 +22,8 @@ const integrationSlugNameMapping: Mapping = {
|
||||
"hashicorp-vault": "Vault",
|
||||
"cloudflare-pages": "Cloudflare Pages",
|
||||
"codefresh": "Codefresh",
|
||||
bitbucket: "BitBucket"
|
||||
bitbucket: "BitBucket",
|
||||
northflank: "Northflank"
|
||||
};
|
||||
|
||||
const envMapping: Mapping = {
|
||||
|
||||
BIN
frontend/public/images/integrations/Northflank.png
Normal file
BIN
frontend/public/images/integrations/Northflank.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
@@ -4,7 +4,7 @@ interface Props {
|
||||
integrationAuthId: string;
|
||||
isActive: boolean;
|
||||
secretPath: string;
|
||||
secretGroup: string;
|
||||
secretGroup?: string;
|
||||
app: string | null;
|
||||
appId: string | null;
|
||||
sourceEnvironment: string;
|
||||
|
||||
@@ -33,7 +33,7 @@ export default function NorthflankCreateIntegrationPage() {
|
||||
const [secretPath, setSecretPath] = useState("/");
|
||||
const [targetApp, setTargetApp] = useState("");
|
||||
const [secretGroupList, setSecretGroupList] = useState<any>([]);
|
||||
const [targetSecretGroup, setTargetSecretGroup] = useState<any>("");
|
||||
const [targetSecretGroup, setTargetSecretGroup] = useState("");
|
||||
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
@@ -57,10 +57,13 @@ export default function NorthflankCreateIntegrationPage() {
|
||||
if (integrationAuthApps) {
|
||||
if (integrationAuthApps.length > 0) {
|
||||
const selectedApp = integrationAuthApps?.filter((integrationAuthApp) => integrationAuthApp.name === targetApp);
|
||||
setSecretGroupList(selectedApp[0].secretGroups);
|
||||
setTargetSecretGroup(selectedApp[0]?.secretGroups[0]);
|
||||
} else {
|
||||
setTargetSecretGroup("none");
|
||||
if (selectedApp.length > 0) {
|
||||
setSecretGroupList(selectedApp[0].secretGroups);
|
||||
setTargetSecretGroup(selectedApp[0]?.secretGroups[0]);
|
||||
} else {
|
||||
setSecretGroupList([]);
|
||||
setTargetSecretGroup("none");
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [targetApp])
|
||||
@@ -169,7 +172,7 @@ export default function NorthflankCreateIntegrationPage() {
|
||||
</SelectItem>
|
||||
))
|
||||
) : (
|
||||
<SelectItem value="none" key="target-secret-group-none">
|
||||
<SelectItem value="No secret groups found" key="target-app-none">
|
||||
No secret groups found
|
||||
</SelectItem>
|
||||
)}
|
||||
@@ -180,7 +183,7 @@ export default function NorthflankCreateIntegrationPage() {
|
||||
color="mineshaft"
|
||||
className="mt-4"
|
||||
isLoading={isLoading}
|
||||
isDisabled={integrationAuthApps.length === 0}
|
||||
isDisabled={integrationAuthApps.length === 0 && secretGroupList === 0}
|
||||
>
|
||||
Create Integration
|
||||
</Button>
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/picomatch": "^2.3.0",
|
||||
"eslint": "^8.29.0",
|
||||
"husky": "^8.0.2"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user