diff --git a/.gitignore b/.gitignore index 7a4abb07c..acedfa4a4 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ bundle.js bundle.map *.bundle.js *.bundle.map +.env # conflicts with FB internal infra .watchmanconfig diff --git a/desktop/.gitignore b/desktop/.gitignore index 9766c2add..1682a65fe 100644 --- a/desktop/.gitignore +++ b/desktop/.gitignore @@ -5,3 +5,4 @@ node_modules/ /static/defaultPlugins/index.json /app/src/defaultPlugins/index.tsx /coverage +.env diff --git a/desktop/package.json b/desktop/package.json index b66eb95d9..8df7d8962 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -171,6 +171,7 @@ "chalk": "^4.0.0", "cross-env": "^7.0.2", "detect-port": "^1.1.1", + "dotenv": "^8.2.0", "electron": "10.1.3", "electron-builder": "^22.8.0", "eslint": "^7.9.0", diff --git a/desktop/plugin-lib/src/pluginPaths.ts b/desktop/plugin-lib/src/pluginPaths.ts index 7d1d57c6e..2801e37fb 100644 --- a/desktop/plugin-lib/src/pluginPaths.ts +++ b/desktop/plugin-lib/src/pluginPaths.ts @@ -25,7 +25,7 @@ export const pluginCacheDir = path.join(flipperDataDir, 'plugins'); export async function getPluginSourceFolders(): Promise { const pluginFolders: string[] = []; - if (process.env.FLIPPER_NO_EMBEDDED_PLUGINS === 'true') { + if (process.env.FLIPPER_NO_EMBEDDED_PLUGINS) { console.log( '🥫 Skipping embedded plugins because "--no-embedded-plugins" flag provided', ); diff --git a/desktop/scripts/start-dev-server.ts b/desktop/scripts/start-dev-server.ts index b24b19c60..c0395544e 100644 --- a/desktop/scripts/start-dev-server.ts +++ b/desktop/scripts/start-dev-server.ts @@ -7,6 +7,7 @@ * @format */ +const dotenv = require('dotenv').config(); const electronBinary: string = require('electron') as any; import codeFrame from '@babel/code-frame'; import socketIo from 'socket.io'; @@ -356,5 +357,8 @@ function checkDevServer() { await startMetroServer(app, server); outputScreen(socket); await compileMain(); + if (dotenv && dotenv.parsed) { + console.log('✅ Loaded env vars from .env file: ', dotenv.parsed); + } shutdownElectron = launchElectron(port); })(); diff --git a/desktop/static/main.ts b/desktop/static/main.ts index c5fd2fb2b..6ca65ac7f 100644 --- a/desktop/static/main.ts +++ b/desktop/static/main.ts @@ -283,7 +283,7 @@ function createWindow() { }); win.once('ready-to-show', () => { win.show(); - if (argv['open-dev-tools']) { + if (argv['open-dev-tools'] || process.env.FLIPPER_OPEN_DEV_TOOLS) { win.webContents.openDevTools(); } });