Add support to load settings from options (flag) and default to specific options

Summary: This change gives priority to a user option settingsString to set up the flipper-server configuration and load them from a json string. Also giving the user the chance to avoid flipper-server looking at the launcher config files in the computer

Reviewed By: mweststrate

Differential Revision: D34210110

fbshipit-source-id: 9e852b79da106b5140c59116fd7d0c0f3155e620
This commit is contained in:
Andres Orozco Gonzalez
2022-02-16 06:21:58 -08:00
committed by Facebook GitHub Bot
parent ff872400c7
commit b2dae4da81
5 changed files with 55 additions and 7 deletions

View File

@@ -28,6 +28,8 @@ import fs from 'fs';
export async function startFlipperServer(
rootDir: string,
staticPath: string,
settingsString: string,
enableLauncherSettings: boolean,
): Promise<FlipperServerImpl> {
if (os.platform() === 'darwin') {
// By default Node.JS has its internal certificate storage and doesn't use
@@ -85,9 +87,9 @@ export async function startFlipperServer(
tempPath: os.tmpdir(),
desktopPath: desktopPath,
},
launcherSettings: await loadLauncherSettings(),
launcherSettings: await loadLauncherSettings(enableLauncherSettings),
processConfig: loadProcessConfig(env),
settings: await loadSettings(),
settings: await loadSettings(settingsString),
validWebSocketOrigins: ['localhost:', 'http://localhost:'],
},
logger,