Improve background launch and port overrides
This commit is contained in:
@@ -20,7 +20,12 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const portsArg = process.argv.find((arg) => arg.startsWith("--ports="))?.split("=", 2)[1];
|
const portsArg = process.argv.find((arg) => arg.startsWith("--ports="))?.split("=", 2)[1];
|
||||||
const ports = portsArg ? portsArg.split(",").map(Number).filter(Boolean) : [];
|
const configuredPorts = portsArg ? portsArg.split(",").map(Number).filter(Boolean) : [];
|
||||||
|
const ports = configuredPorts.map((port, index) => {
|
||||||
|
if (index === 0 && process.env.PORT) return Number(process.env.PORT) || port;
|
||||||
|
if (index === 1 && process.env.VITE_PORT) return Number(process.env.VITE_PORT) || port;
|
||||||
|
return port;
|
||||||
|
});
|
||||||
|
|
||||||
function isPortBusy(port) {
|
function isPortBusy(port) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user