Patch integrations Secret querying by workspaceId

This commit is contained in:
Tuan Dang
2023-01-09 17:11:33 +07:00
parent bd5dad71d4
commit d2c77d9985
5 changed files with 14 additions and 11 deletions
@@ -65,7 +65,6 @@ export const createAPIKeyData = async (req: Request, res: Response) => {
apiKey = `ak.${apiKeyData._id.toString()}.${secret}`; apiKey = `ak.${apiKeyData._id.toString()}.${secret}`;
} catch (err) { } catch (err) {
console.error(err);
Sentry.setUser({ email: req.user.email }); Sentry.setUser({ email: req.user.email });
Sentry.captureException(err); Sentry.captureException(err);
return res.status(400).send({ return res.status(400).send({
+2 -2
View File
@@ -72,7 +72,7 @@ const getSecretsHelper = async ({
try { try {
const key = await getKey({ workspaceId }); const key = await getKey({ workspaceId });
const secrets = await Secret.find({ const secrets = await Secret.find({
workspaceId, workspace: workspaceId,
environment, environment,
type: SECRET_SHARED type: SECRET_SHARED
}); });
@@ -84,7 +84,7 @@ const getSecretsHelper = async ({
tag: secret.secretKeyTag, tag: secret.secretKeyTag,
key key
}); });
const secretValue = decryptSymmetric({ const secretValue = decryptSymmetric({
ciphertext: secret.secretValueCiphertext, ciphertext: secret.secretValueCiphertext,
iv: secret.secretValueIV, iv: secret.secretValueIV,
-1
View File
@@ -55,7 +55,6 @@ const validateSecrets = async ({
}); });
} catch (err) { } catch (err) {
console.error(err);
throw new Error('Failed to validate secrets'); throw new Error('Failed to validate secrets');
} }
+3 -3
View File
@@ -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: ''
@@ -23,6 +23,7 @@ import {
interface Integration { interface Integration {
_id: string; _id: string;
app?: string; app?: string;
target?: string;
environment: string; environment: string;
integration: string; integration: string;
integrationAuth: string; integrationAuth: string;
@@ -69,7 +70,11 @@ const Integration = ({
switch (integration.integration) { switch (integration.integration) {
case "vercel": case "vercel":
setIntegrationTarget("Development"); setIntegrationTarget(
integration?.target
? integration.target.charAt(0).toUpperCase() + integration.target.substring(1)
: "Development"
);
break; break;
case "netlify": case "netlify":
setIntegrationContext(integration?.context ? contextNetlifyMapping[integration.context] : "Local development"); setIntegrationContext(integration?.context ? contextNetlifyMapping[integration.context] : "Local development");
@@ -93,11 +98,11 @@ const Integration = ({
</div> </div>
<ListBox <ListBox
data={!integration.isActive ? [ data={!integration.isActive ? [
"Production", "Development",
"Preview", "Preview",
"Development" "Production"
] : null} ] : null}
selected={"Production"} selected={integrationTarget}
onChange={setIntegrationTarget} onChange={setIntegrationTarget}
/> />
</div> </div>