Add FLIPPER_PORTS env var to desktop app

Summary:
Part 3 and final part of adding customizable ports. To use this, the iOS / Android apps have to also be started with the same custom ports.

Example usage: `FLIPPER_PORTS=8189,8188 yarn start`

Reviewed By: passy

Differential Revision: D13801761

fbshipit-source-id: 3dd80a3001ed0855e54cc568fa94eb6fac5fc7f1
This commit is contained in:
John Knox
2019-01-25 06:29:05 -08:00
committed by Facebook Github Bot
parent e558d8a01a
commit dbb723f8a5
9 changed files with 124 additions and 27 deletions

View File

@@ -24,9 +24,6 @@ const invariant = require('invariant');
const tls = require('tls');
const net = require('net');
export const SECURE_PORT = 8088;
export const INSECURE_PORT = 8089;
type RSocket = {|
fireAndForget(payload: {data: string}): void,
connectionStatus(): any,
@@ -62,13 +59,12 @@ export default class Server extends EventEmitter {
((event: 'clients-change', callback: () => void) => void);
init() {
const {insecure, secure} = this.store.getState().application.serverPorts;
this.initialisePromise = this.certificateProvider
.loadSecureServerConfig()
.then(
options => (this.secureServer = this.startServer(SECURE_PORT, options)),
)
.then(options => (this.secureServer = this.startServer(secure, options)))
.then(() => {
this.insecureServer = this.startServer(INSECURE_PORT);
this.insecureServer = this.startServer(insecure);
return;
});
recordSuccessMetric(this.initialisePromise, 'initializeServer');