parent
86cabd8bb7
commit
68a3398f54
@ -13,6 +13,6 @@ WORKDIR /peer-server
|
|||||||
COPY package.json package-lock.json ./
|
COPY package.json package-lock.json ./
|
||||||
RUN npm clean-install --omit=dev
|
RUN npm clean-install --omit=dev
|
||||||
COPY --from=build /peer-server/dist/bin/peerjs.js ./
|
COPY --from=build /peer-server/dist/bin/peerjs.js ./
|
||||||
EXPOSE 9000
|
ENV PORT 9000
|
||||||
|
EXPOSE ${PORT}
|
||||||
ENTRYPOINT ["node", "peerjs.js"]
|
ENTRYPOINT ["node", "peerjs.js"]
|
||||||
CMD [ "--port", "9000" ]
|
|
||||||
|
@ -11,6 +11,8 @@ import type { AddressInfo } from "node:net";
|
|||||||
|
|
||||||
const y = yargs(hideBin(process.argv));
|
const y = yargs(hideBin(process.argv));
|
||||||
|
|
||||||
|
const portEnvIsSet = !!process.env["PORT"]
|
||||||
|
|
||||||
const opts = y
|
const opts = y
|
||||||
.usage("Usage: $0")
|
.usage("Usage: $0")
|
||||||
.wrap(Math.min(optimistUsageLength, y.terminalWidth()))
|
.wrap(Math.min(optimistUsageLength, y.terminalWidth()))
|
||||||
@ -56,7 +58,7 @@ const opts = y
|
|||||||
},
|
},
|
||||||
port: {
|
port: {
|
||||||
type: "number",
|
type: "number",
|
||||||
demandOption: true,
|
demandOption: !portEnvIsSet,
|
||||||
alias: "p",
|
alias: "p",
|
||||||
describe: "port",
|
describe: "port",
|
||||||
},
|
},
|
||||||
@ -80,6 +82,9 @@ const opts = y
|
|||||||
})
|
})
|
||||||
.boolean("allow_discovery").parseSync();
|
.boolean("allow_discovery").parseSync();
|
||||||
|
|
||||||
|
if(!opts.port){
|
||||||
|
opts.port= parseInt(process.env["PORT"] as string)
|
||||||
|
}
|
||||||
process.on("uncaughtException", function (e) {
|
process.on("uncaughtException", function (e) {
|
||||||
console.error("Error: " + e);
|
console.error("Error: " + e);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user