diff --git a/packages/features/ee/sso/lib/jackson.ts b/packages/features/ee/sso/lib/jackson.ts index 777bcfb8d5..3ca9d09940 100644 --- a/packages/features/ee/sso/lib/jackson.ts +++ b/packages/features/ee/sso/lib/jackson.ts @@ -6,7 +6,7 @@ import type { ISPSAMLConfig, } from "@boxyhq/saml-jackson"; -import {WEBAPP_URL} from "@calcom/lib/constants"; +import { WEBAPP_URL } from "@calcom/lib/constants"; import { samlDatabaseUrl, samlAudience, samlPath, oidcPath, clientSecretVerifier } from "./saml"; @@ -26,38 +26,25 @@ const opts: JacksonOption = { clientSecretVerifier, }; -let connectionController: IConnectionAPIController; -let oauthController: IOAuthController; -let samlSPConfig: ISPSAMLConfig; - -const g = global; - declare global { + /* eslint-disable no-var */ var connectionController: IConnectionAPIController | undefined; var oauthController: IOAuthController | undefined; var samlSPConfig: ISPSAMLConfig | undefined; + /* eslint-enable no-var */ } export default async function init() { - if (!g.connectionController || !g.oauthController || !g.samlSPConfig) { + if (!globalThis.connectionController || !globalThis.oauthController || !globalThis.samlSPConfig) { const ret = await jackson(opts); - - connectionController = ret.connectionAPIController; - oauthController = ret.oauthController; - samlSPConfig = ret.spConfig; - - g.connectionController = connectionController; - g.oauthController = oauthController; - g.samlSPConfig = samlSPConfig; - } else { - connectionController = g.connectionController; - oauthController = g.oauthController; - samlSPConfig = g.samlSPConfig; + globalThis.connectionController = ret.connectionAPIController; + globalThis.oauthController = ret.oauthController; + globalThis.samlSPConfig = ret.spConfig; } return { - connectionController, - oauthController, - samlSPConfig, + connectionController: globalThis.connectionController, + oauthController: globalThis.oauthController, + samlSPConfig: globalThis.samlSPConfig, }; }