add logs for integration and comment out google sso

This commit is contained in:
Maidul Islam
2023-07-21 17:29:56 -04:00
parent c02c8e67d3
commit 1807b3e029
3 changed files with 43 additions and 38 deletions
+39 -34
View File
@@ -115,46 +115,51 @@ export const syncIntegrationsHelper = async ({
workspaceId: Types.ObjectId; workspaceId: Types.ObjectId;
environment?: string; environment?: string;
}) => { }) => {
const integrations = await Integration.find({ try {
workspace: workspaceId, const integrations = await Integration.find({
...(environment workspace: workspaceId,
? { ...(environment
? {
environment, environment,
} }
: {}), : {}),
isActive: true, isActive: true,
app: { $ne: null }, app: { $ne: null },
});
// for each workspace integration, sync/push secrets
// to that integration
for await (const integration of integrations) {
// get workspace, environment (shared) secrets
const secrets = await BotService.getSecrets({
// issue here?
workspaceId: integration.workspace,
environment: integration.environment,
secretPath: integration.secretPath,
}); });
const integrationAuth = await IntegrationAuth.findById( // for each workspace integration, sync/push secrets
integration.integrationAuth // to that integration
); for await (const integration of integrations) {
if (!integrationAuth) throw new Error("Failed to find integration auth"); // get workspace, environment (shared) secrets
const secrets = await BotService.getSecrets({
// issue here?
workspaceId: integration.workspace,
environment: integration.environment,
secretPath: integration.secretPath,
});
// get integration auth access token const integrationAuth = await IntegrationAuth.findById(
const access = await getIntegrationAuthAccessHelper({ integration.integrationAuth
integrationAuthId: integration.integrationAuth, );
}); if (!integrationAuth) throw new Error("Failed to find integration auth");
// sync secrets to integration // get integration auth access token
await syncSecrets({ const access = await getIntegrationAuthAccessHelper({
integration, integrationAuthId: integration.integrationAuth,
integrationAuth, });
secrets,
accessId: access.accessId === undefined ? null : access.accessId, // sync secrets to integration
accessToken: access.accessToken, await syncSecrets({
}); integration,
integrationAuth,
secrets,
accessId: access.accessId === undefined ? null : access.accessId,
accessToken: access.accessToken,
});
}
} catch (err) {
console.log(`syncIntegrationsHelper: failed with [workspaceId=${workspaceId}] [environment=${environment}]`, err) // eslint-disable-line no-use-before-define
throw err
} }
}; };
@@ -34,7 +34,7 @@ export default function InitialSignupStep({
<span className='px-4 text-sm text-bunker-400'>or</span> <span className='px-4 text-sm text-bunker-400'>or</span>
<div className='w-1/2 border-t border-mineshaft-500' /> <div className='w-1/2 border-t border-mineshaft-500' />
</div> </div>
<div className='lg:w-1/6 w-1/4 min-w-[20rem] rounded-md'> {/* <div className='lg:w-1/6 w-1/4 min-w-[20rem] rounded-md'>
<Button <Button
colorSchema="primary" colorSchema="primary"
variant="solid" variant="solid"
@@ -47,7 +47,7 @@ export default function InitialSignupStep({
> >
{t("signup.continue-with-google")} {t("signup.continue-with-google")}
</Button> </Button>
</div> </div> */}
<div className='lg:w-1/6 w-1/4 min-w-[20rem] text-center rounded-md mt-4'> <div className='lg:w-1/6 w-1/4 min-w-[20rem] text-center rounded-md mt-4'>
<Button <Button
colorSchema="primary" colorSchema="primary"
@@ -159,7 +159,7 @@ export const InitialStep = ({
<span className='px-4 text-sm text-bunker-400'>or</span> <span className='px-4 text-sm text-bunker-400'>or</span>
<div className='w-1/2 border-t border-mineshaft-500' /> <div className='w-1/2 border-t border-mineshaft-500' />
</div> </div>
<div className='lg:w-1/6 w-1/4 min-w-[20rem] rounded-md'> {/* <div className='lg:w-1/6 w-1/4 min-w-[20rem] rounded-md'>
<Button <Button
colorSchema="primary" colorSchema="primary"
variant="solid" variant="solid"
@@ -172,7 +172,7 @@ export const InitialStep = ({
> >
{t("login.continue-with-google")} {t("login.continue-with-google")}
</Button> </Button>
</div> </div> */}
<div className='lg:w-1/6 w-1/4 min-w-[20rem] text-center rounded-md mt-4'> <div className='lg:w-1/6 w-1/4 min-w-[20rem] text-center rounded-md mt-4'>
<Button <Button
colorSchema="primary" colorSchema="primary"