diff --git a/desktop/app/src/init.tsx b/desktop/app/src/init.tsx index 989cd73bc..18cb9ba70 100644 --- a/desktop/app/src/init.tsx +++ b/desktop/app/src/init.tsx @@ -56,9 +56,17 @@ import {Module} from 'module'; Module.prototype.require = wrapRequire(Module.prototype.require); enableMapSet(); -async function getKeytarModule(staticPath: string): Promise { +async function getKeytarModule( + staticPath: string, +): Promise { let keytar: any = undefined; try { + if (process.env.FLIPPER_DISABLE_KEYTAR) { + console.log( + 'Using keytar in-memory implementation as per FLIPPER_DISABLE_KEYTAR env var.', + ); + return undefined; + } if (!isTest()) { const keytarPath = path.join( staticPath, @@ -112,7 +120,7 @@ async function getFlipperServer( isProduction, false, ); - const keytar: KeytarModule = await getKeytarModule(staticPath); + const keytar: KeytarModule | undefined = await getKeytarModule(staticPath); const gatekeepers = getGatekeepers(environmentInfo.os.unixname); const serverUsageEnabled = gatekeepers['flipper_desktop_use_server']; diff --git a/desktop/flipper-server-core/src/server/startFlipperServer.tsx b/desktop/flipper-server-core/src/server/startFlipperServer.tsx index 25604ffe4..243887fb0 100644 --- a/desktop/flipper-server-core/src/server/startFlipperServer.tsx +++ b/desktop/flipper-server-core/src/server/startFlipperServer.tsx @@ -38,7 +38,7 @@ export async function startFlipperServer( staticPath: string, settingsString: string, enableLauncherSettings: boolean, - keytarModule: KeytarModule, + keytarModule: KeytarModule | undefined, type: FlipperServerType, environmentInfo: EnvironmentInfo, ): Promise { diff --git a/desktop/flipper-server/src/index.tsx b/desktop/flipper-server/src/index.tsx index afb383163..9eb175aba 100644 --- a/desktop/flipper-server/src/index.tsx +++ b/desktop/flipper-server/src/index.tsx @@ -164,7 +164,11 @@ async function start() { let keytar: any = undefined; try { - if (!isTest()) { + if (process.env.FLIPPER_DISABLE_KEYTAR) { + console.log( + '[flipper-server][bootstrap] Using keytar in-memory implementation as per FLIPPER_DISABLE_KEYTAR env var.', + ); + } else if (!isTest()) { const keytarPath = path.join( staticPath, 'native-modules',