mirror of
https://github.com/Infisical/infisical.git
synced 2025-03-29 22:02:57 +00:00
.github
.husky
backend
__tests__
img
src
config
controllers
ee
events
helpers
integrations
middleware
models
routes
status
v1
auth.ts
bot.ts
index.ts
integration.ts
integrationAuth.ts
inviteOrg.ts
key.ts
membership.ts
membershipOrg.ts
organization.ts
password.ts
secret.ts
serviceToken.ts
signup.ts
stripe.ts
user.ts
userAction.ts
workspace.ts
v2
services
templates
types
utils
variables
app.ts
index.ts
swagger
test-resources
.dockerignore
.eslintignore
.eslintrc
Dockerfile
environment.d.ts
healthcheck.js
nodemon.json
package-lock.json
package.json
spec.json
tsconfig.json
cli
docs
frontend
helm-charts
i18n
img
k8-operator
nginx
.env.example
.eslintignore
.gitignore
.goreleaser.yaml
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
Makefile
README.md
SECURITY.md
docker-compose.dev.yml
docker-compose.yml
package-lock.json
package.json
60 lines
1.4 KiB
TypeScript
60 lines
1.4 KiB
TypeScript
import express from 'express';
|
|
const router = express.Router();
|
|
import {
|
|
requireAuth,
|
|
requireIntegrationAuth,
|
|
requireIntegrationAuthorizationAuth,
|
|
validateRequest
|
|
} from '../../middleware';
|
|
import { ADMIN, MEMBER } from '../../variables';
|
|
import { body, param } from 'express-validator';
|
|
import { integrationController } from '../../controllers/v1';
|
|
|
|
router.post( // new: add new integration
|
|
'/',
|
|
requireAuth({
|
|
acceptedAuthModes: ['jwt', 'apiKey']
|
|
}),
|
|
requireIntegrationAuthorizationAuth({
|
|
acceptedRoles: [ADMIN, MEMBER],
|
|
location: 'body'
|
|
}),
|
|
body('integrationAuthId').exists().trim(),
|
|
validateRequest,
|
|
integrationController.createIntegration
|
|
);
|
|
|
|
router.patch(
|
|
'/:integrationId',
|
|
requireAuth({
|
|
acceptedAuthModes: ['jwt']
|
|
}),
|
|
requireIntegrationAuth({
|
|
acceptedRoles: [ADMIN, MEMBER]
|
|
}),
|
|
param('integrationId').exists().trim(),
|
|
body('isActive').exists().isBoolean(),
|
|
body('app').exists().trim(),
|
|
body('environment').exists().trim(),
|
|
body('appId').exists(),
|
|
body('targetEnvironment').exists(),
|
|
body('owner').exists(),
|
|
validateRequest,
|
|
integrationController.updateIntegration
|
|
);
|
|
|
|
router.delete(
|
|
'/:integrationId',
|
|
requireAuth({
|
|
acceptedAuthModes: ['jwt']
|
|
}),
|
|
requireIntegrationAuth({
|
|
acceptedRoles: [ADMIN, MEMBER]
|
|
}),
|
|
param('integrationId').exists().trim(),
|
|
validateRequest,
|
|
integrationController.deleteIntegration
|
|
);
|
|
|
|
export default router;
|