FLIPPER_DISABLE_KEYTAR env var to use in-memory impl

Summary: Changelog: FLIPPER_DISABLE_KEYTAR env var can be used to force in-memory implementation

Reviewed By: lblasa

Differential Revision: D49183501

fbshipit-source-id: 4ce886303678485673750417b09f272dd3f66623
This commit is contained in:
Pascal Hartig
2023-09-12 04:21:41 -07:00
committed by Facebook GitHub Bot
parent b60a8537ff
commit cd392929e0
3 changed files with 16 additions and 4 deletions

View File

@@ -56,9 +56,17 @@ import {Module} from 'module';
Module.prototype.require = wrapRequire(Module.prototype.require);
enableMapSet();
async function getKeytarModule(staticPath: string): Promise<KeytarModule> {
async function getKeytarModule(
staticPath: string,
): Promise<KeytarModule | undefined> {
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'];