Skip to content

Commit

Permalink
Patch integrations Secret querying by workspaceId
Browse files Browse the repository at this point in the history
  • Loading branch information
dangtony98 committed Jan 9, 2023
1 parent bd5dad7 commit d2c77d9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
1 change: 0 additions & 1 deletion backend/src/controllers/v2/apiKeyDataController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export const createAPIKeyData = async (req: Request, res: Response) => {
apiKey = `ak.${apiKeyData._id.toString()}.${secret}`;

} catch (err) {
console.error(err);
Sentry.setUser({ email: req.user.email });
Sentry.captureException(err);
return res.status(400).send({
Expand Down
4 changes: 2 additions & 2 deletions backend/src/helpers/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const getSecretsHelper = async ({
try {
const key = await getKey({ workspaceId });
const secrets = await Secret.find({
workspaceId,
workspace: workspaceId,
environment,
type: SECRET_SHARED
});
Expand All @@ -84,7 +84,7 @@ const getSecretsHelper = async ({
tag: secret.secretKeyTag,
key
});

const secretValue = decryptSymmetric({
ciphertext: secret.secretValueCiphertext,
iv: secret.secretValueIV,
Expand Down
1 change: 0 additions & 1 deletion backend/src/helpers/secret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const validateSecrets = async ({
});

} catch (err) {
console.error(err);
throw new Error('Failed to validate secrets');
}

Expand Down
6 changes: 3 additions & 3 deletions backend/src/variables/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const INTEGRATION_OPTIONS = [
name: 'Vercel',
slug: 'vercel',
image: 'Vercel',
isAvailable: false,
isAvailable: true,
type: 'vercel',
clientId: '',
clientSlug: CLIENT_SLUG_VERCEL,
Expand All @@ -58,7 +58,7 @@ const INTEGRATION_OPTIONS = [
name: 'Netlify',
slug: 'netlify',
image: 'Netlify',
isAvailable: false,
isAvailable: true,
type: 'oauth2',
clientId: CLIENT_ID_NETLIFY,
docsLink: ''
Expand All @@ -67,7 +67,7 @@ const INTEGRATION_OPTIONS = [
name: 'GitHub',
slug: 'github',
image: 'GitHub',
isAvailable: false,
isAvailable: true,
type: 'oauth2',
clientId: CLIENT_ID_GITHUB,
docsLink: ''
Expand Down
13 changes: 9 additions & 4 deletions frontend/components/integrations/Integration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
interface Integration {
_id: string;
app?: string;
target?: string;
environment: string;
integration: string;
integrationAuth: string;
Expand Down Expand Up @@ -69,7 +70,11 @@ const Integration = ({

switch (integration.integration) {
case "vercel":
setIntegrationTarget("Development");
setIntegrationTarget(
integration?.target
? integration.target.charAt(0).toUpperCase() + integration.target.substring(1)
: "Development"
);
break;
case "netlify":
setIntegrationContext(integration?.context ? contextNetlifyMapping[integration.context] : "Local development");
Expand All @@ -93,11 +98,11 @@ const Integration = ({
</div>
<ListBox
data={!integration.isActive ? [
"Production",
"Development",
"Preview",
"Development"
"Production"
] : null}
selected={"Production"}
selected={integrationTarget}
onChange={setIntegrationTarget}
/>
</div>
Expand Down

0 comments on commit d2c77d9

Please sign in to comment.