CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/backend/port.ts
Views: 687
1
/* Determine the port that the hub will serve on.
2
3
If the environment variable PORT is set, use that port; otherwise, use port 5000.
4
5
The default export of this module is the port number.
6
*/
7
8
const DEFAULT_PORT = 5000;
9
10
function port(): number {
11
if (process.env.PORT) {
12
return parseInt(process.env.PORT);
13
}
14
return DEFAULT_PORT;
15
}
16
17
export default port();
18
19