2018-05-26 11:18:54 +01:00
|
|
|
function randomClipperPort(state, env) {
|
2018-05-25 11:08:22 +01:00
|
|
|
if (!state) {
|
2018-06-18 18:54:48 +01:00
|
|
|
state = { offset: 0 };
|
2018-05-25 11:08:22 +01:00
|
|
|
} else {
|
2018-06-18 18:54:48 +01:00
|
|
|
state.offset++;
|
2018-05-25 11:08:22 +01:00
|
|
|
}
|
|
|
|
|
2019-09-08 17:16:45 +01:00
|
|
|
state.port = startPort(env) + state.offset;
|
2018-05-25 11:08:22 +01:00
|
|
|
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2019-09-08 17:16:45 +01:00
|
|
|
function startPort(env) {
|
|
|
|
const startPorts = {
|
|
|
|
prod: 41184,
|
|
|
|
dev: 27583,
|
|
|
|
};
|
|
|
|
|
|
|
|
return env === 'prod' ? startPorts.prod : startPorts.dev;
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = { randomClipperPort, startPort };
|