Fix excessive error login for FLIPPER_BROWSER_PORT

Summary: Prior to this diff, an empty env var FLIPPER_BROWSER_PORT resulted in an error

Reviewed By: passy

Differential Revision: D33712720

fbshipit-source-id: 760fc92bbf44268ec428a3d2947735d5cf8567b7
This commit is contained in:
Andrey Goncharov
2022-01-21 13:27:22 -08:00
committed by Facebook GitHub Bot
parent 76a9b3d3ae
commit b5cd33f7e8

View File

@@ -63,15 +63,18 @@ export function getServerPortsConfig(): {
} }
} }
const portBrowserOverride = parseEnvironmentVariableAsNumber( let portBrowserOverride: number | undefined;
'FLIPPER_BROWSER_PORT', if (process.env.FLIPPER_BROWSER_PORT) {
); portBrowserOverride = parseEnvironmentVariableAsNumber(
if (portBrowserOverride === undefined) { 'FLIPPER_BROWSER_PORT',
console.error( );
`Ignoring malformed FLIPPER_BROWSER_PORT env variable: if (!portBrowserOverride) {
console.error(
`Ignoring malformed FLIPPER_BROWSER_PORT env variable:
"${process.env.FLIPPER_BROWSER_PORT || ''}". "${process.env.FLIPPER_BROWSER_PORT || ''}".
Example expected format: "1111".`, Example expected format: "1111".`,
); );
}
} }
return { return {