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