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:
committed by
Facebook Github Bot
parent
e558d8a01a
commit
dbb723f8a5
@@ -26,6 +26,10 @@ export type State = {
|
||||
windowIsFocused: boolean,
|
||||
activeSheet: ActiveSheet,
|
||||
sessionId: ?string,
|
||||
serverPorts: {
|
||||
insecure: number,
|
||||
secure: number,
|
||||
},
|
||||
};
|
||||
|
||||
type BooleanActionType =
|
||||
@@ -42,6 +46,13 @@ export type Action =
|
||||
| {
|
||||
type: 'SET_ACTIVE_SHEET',
|
||||
payload: ActiveSheet,
|
||||
}
|
||||
| {
|
||||
type: 'SET_SERVER_PORTS',
|
||||
payload: {
|
||||
insecure: number,
|
||||
secure: number,
|
||||
},
|
||||
};
|
||||
|
||||
const initialState: () => State = () => ({
|
||||
@@ -51,6 +62,10 @@ const initialState: () => State = () => ({
|
||||
windowIsFocused: remote.getCurrentWindow().isFocused(),
|
||||
activeSheet: null,
|
||||
sessionId: uuidv1(),
|
||||
serverPorts: {
|
||||
insecure: 8089,
|
||||
secure: 8088,
|
||||
},
|
||||
});
|
||||
|
||||
export default function reducer(state: State, action: Action): State {
|
||||
@@ -80,6 +95,12 @@ export default function reducer(state: State, action: Action): State {
|
||||
...state,
|
||||
activeSheet: action.payload,
|
||||
};
|
||||
}
|
||||
if (action.type === 'SET_SERVER_PORTS') {
|
||||
return {
|
||||
...state,
|
||||
serverPorts: action.payload,
|
||||
};
|
||||
} else {
|
||||
return state;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user