format import { FlipperServerConfig } from 'flipper-common' ; import { parseFlipperPorts } from './utils/environmentVariables' ; let currentConfig = undefined ; export function getFlipperServerConfig ( ) { if ( ! currentConfig ) { throw new Error ( 'FlipperServerConfig has not been set' ) ; } return currentConfig ; } export function setFlipperServerConfig ( config ) { currentConfig = config ; } type ServerPorts = { insecure : number ; secure : number ; } ; export function getServerPortsConfig ( ) { let portOverrides ; if ( process . env . FLIPPER_PORTS ) { portOverrides = parseFlipperPorts ( process . env . FLIPPER_PORTS ) ; if ( ! portOverrides ) { console . error ( `Ignoring malformed FLIPPER_PORTS env variable:
          "${ process . env . FLIPPER_PORTS || '' }".
          Example expected format: "1111,2222".` ) ; } } let portAltOverrides ; if ( process . env . FLIPPER_ALT_PORTS ) { portAltOverrides = parseFlipperPorts ( process . env . FLIPPER_ALT_PORTS ) ; if ( ! portAltOverrides ) { console . error ( `Ignoring malformed FLIPPER_ALT_PORTS env variable:
          "${ process . env . FLIPPER_ALT_PORTS || '' }".
          Example expected format: "1111,2222".` ) ; } } return { serverPorts : portOverrides ?? { insecure : 8089 , secure : 8088 , } , altServerPorts : portAltOverrides ?? { insecure : 9089 , secure : 9088 , } , } ; }