mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2026-08-13 12:33:07 +02:00
RTL conf standardization
This commit is contained in:
parent
5151492fee
commit
b2229b2e57
6 changed files with 175 additions and 144 deletions
21
rtl.js
21
rtl.js
|
|
@ -3,18 +3,6 @@ const common = require("./common");
|
|||
const debug = require("debug")("node-angular");
|
||||
const http = require("http");
|
||||
|
||||
const normalizePort = val => {
|
||||
var port = parseInt(val, 10);
|
||||
if (isNaN(port)) {
|
||||
return val;
|
||||
}
|
||||
if (port >= 0) {
|
||||
common.port = port;
|
||||
return port;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const onError = error => {
|
||||
if (error.syscall !== "listen") {
|
||||
throw error;
|
||||
|
|
@ -40,15 +28,12 @@ const onError = error => {
|
|||
|
||||
const onListening = () => {
|
||||
const addr = server.address();
|
||||
const bind = typeof addr === "string" ? "pipe " + addr : "port " + port;
|
||||
const bind = typeof addr === "string" ? "pipe " + addr : "port " + common.port;
|
||||
debug("Listening on " + bind);
|
||||
console.log('Server is up and running, please open the UI at http://localhost:' + port);
|
||||
console.log('Server is up and running, please open the UI at http://localhost:' + common.port);
|
||||
};
|
||||
|
||||
const port = normalizePort(process.env.PORT || common.port);
|
||||
|
||||
const server = http.createServer(app);
|
||||
server.on("error", onError);
|
||||
server.on("listening", onListening);
|
||||
server.listen(port);
|
||||
|
||||
server.listen(common.port);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue