mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 05:27:48 +00:00
Merge pull request #212 from Infisical/patch-integrations
Bring back sync integrations to CRUD secrets routes
This commit is contained in:
@@ -11,6 +11,8 @@ import {
|
|||||||
ACTION_DELETE_SECRETS
|
ACTION_DELETE_SECRETS
|
||||||
} from '../../variables';
|
} from '../../variables';
|
||||||
import { ValidationError } from '../../utils/errors';
|
import { ValidationError } from '../../utils/errors';
|
||||||
|
import { EventService } from '../../services';
|
||||||
|
import { eventPushSecrets } from '../../events';
|
||||||
import { EESecretService, EELogService } from '../../ee/services';
|
import { EESecretService, EELogService } from '../../ee/services';
|
||||||
import { postHogClient } from '../../services';
|
import { postHogClient } from '../../services';
|
||||||
import { BadRequestError } from '../../utils/errors';
|
import { BadRequestError } from '../../utils/errors';
|
||||||
@@ -102,6 +104,13 @@ export const createSecrets = async (req: Request, res: Response) => {
|
|||||||
}))
|
}))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// trigger event - push secrets
|
||||||
|
await EventService.handleEvent({
|
||||||
|
event: eventPushSecrets({
|
||||||
|
workspaceId
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
const addAction = await EELogService.createActionSecret({
|
const addAction = await EELogService.createActionSecret({
|
||||||
name: ACTION_ADD_SECRETS,
|
name: ACTION_ADD_SECRETS,
|
||||||
userId: req.user._id.toString(),
|
userId: req.user._id.toString(),
|
||||||
@@ -194,7 +203,7 @@ export const getSecrets = async (req: Request, res: Response) => {
|
|||||||
|
|
||||||
if (postHogClient) {
|
if (postHogClient) {
|
||||||
postHogClient.capture({
|
postHogClient.capture({
|
||||||
event: 'secrets deleted',
|
event: 'secrets added',
|
||||||
distinctId: req.user.email,
|
distinctId: req.user.email,
|
||||||
properties: {
|
properties: {
|
||||||
numberOfSecrets: secrets.length,
|
numberOfSecrets: secrets.length,
|
||||||
@@ -321,6 +330,7 @@ export const updateSecrets = async (req: Request, res: Response) => {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// group secrets into workspaces so updated secrets can
|
// group secrets into workspaces so updated secrets can
|
||||||
// be logged and snapshotted separately for each workspace
|
// be logged and snapshotted separately for each workspace
|
||||||
const workspaceSecretObj: any = {};
|
const workspaceSecretObj: any = {};
|
||||||
@@ -333,6 +343,13 @@ export const updateSecrets = async (req: Request, res: Response) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Object.keys(workspaceSecretObj).forEach(async (key) => {
|
Object.keys(workspaceSecretObj).forEach(async (key) => {
|
||||||
|
// trigger event - push secrets
|
||||||
|
await EventService.handleEvent({
|
||||||
|
event: eventPushSecrets({
|
||||||
|
workspaceId: key
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
const updateAction = await EELogService.createActionSecret({
|
const updateAction = await EELogService.createActionSecret({
|
||||||
name: ACTION_UPDATE_SECRETS,
|
name: ACTION_UPDATE_SECRETS,
|
||||||
userId: req.user._id.toString(),
|
userId: req.user._id.toString(),
|
||||||
@@ -409,6 +426,12 @@ export const deleteSecrets = async (req: Request, res: Response) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Object.keys(workspaceSecretObj).forEach(async (key) => {
|
Object.keys(workspaceSecretObj).forEach(async (key) => {
|
||||||
|
// trigger event - push secrets
|
||||||
|
await EventService.handleEvent({
|
||||||
|
event: eventPushSecrets({
|
||||||
|
workspaceId: key
|
||||||
|
})
|
||||||
|
});
|
||||||
const deleteAction = await EELogService.createActionSecret({
|
const deleteAction = await EELogService.createActionSecret({
|
||||||
name: ACTION_DELETE_SECRETS,
|
name: ACTION_DELETE_SECRETS,
|
||||||
userId: req.user._id.toString(),
|
userId: req.user._id.toString(),
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ const INTEGRATION_OPTIONS = [
|
|||||||
name: 'Vercel',
|
name: 'Vercel',
|
||||||
slug: 'vercel',
|
slug: 'vercel',
|
||||||
image: 'Vercel',
|
image: 'Vercel',
|
||||||
isAvailable: false,
|
isAvailable: true,
|
||||||
type: 'vercel',
|
type: 'vercel',
|
||||||
clientId: '',
|
clientId: '',
|
||||||
clientSlug: CLIENT_SLUG_VERCEL,
|
clientSlug: CLIENT_SLUG_VERCEL,
|
||||||
@@ -58,7 +58,7 @@ const INTEGRATION_OPTIONS = [
|
|||||||
name: 'Netlify',
|
name: 'Netlify',
|
||||||
slug: 'netlify',
|
slug: 'netlify',
|
||||||
image: 'Netlify',
|
image: 'Netlify',
|
||||||
isAvailable: false,
|
isAvailable: true,
|
||||||
type: 'oauth2',
|
type: 'oauth2',
|
||||||
clientId: CLIENT_ID_NETLIFY,
|
clientId: CLIENT_ID_NETLIFY,
|
||||||
docsLink: ''
|
docsLink: ''
|
||||||
@@ -67,7 +67,7 @@ const INTEGRATION_OPTIONS = [
|
|||||||
name: 'GitHub',
|
name: 'GitHub',
|
||||||
slug: 'github',
|
slug: 'github',
|
||||||
image: 'GitHub',
|
image: 'GitHub',
|
||||||
isAvailable: false,
|
isAvailable: true,
|
||||||
type: 'oauth2',
|
type: 'oauth2',
|
||||||
clientId: CLIENT_ID_GITHUB,
|
clientId: CLIENT_ID_GITHUB,
|
||||||
docsLink: ''
|
docsLink: ''
|
||||||
|
|||||||
-1690
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user