[feat] added pm2 configs & .env for port

This commit is contained in:
Maielo 2021-10-17 22:31:14 +02:00
parent 8ab964590d
commit 193cfcc412
6 changed files with 2570 additions and 0 deletions

1
.env.development Normal file
View File

@ -0,0 +1 @@
PORT=3000

2535
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,7 @@
"@typescript-eslint/eslint-plugin": "4.16.1",
"@typescript-eslint/parser": "4.16.1",
"debug": "4.3.1",
"dotenv": "^10.0.0",
"eslint": "7.21.0",
"eslint-config-prettier": "8.1.0",
"eslint-plugin-prettier": "3.3.1",

17
pm2.json Normal file
View File

@ -0,0 +1,17 @@
{
"name": "webex-collab-dev",
"script": "./dist/index.js",
"watch": ["src/"],
"ignore_watch": [
"node_modules",
"public"
],
"autorestart": false,
"exec_mode": "fork_mode",
"instances": 1,
"env": {
"NODE_ENV": "development",
"TZ": "Europe/London"
},
"node_args": ["--inspect=127.0.0.1:9320"]
}

10
pm2production.json Normal file
View File

@ -0,0 +1,10 @@
{
"name": "webex-collab",
"script": "./dist/index.js",
"autorestart": true,
"exec_mode": "fork_mode",
"instances": 1,
"env": {
"NODE_ENV": "production"
}
}

View File

@ -7,6 +7,12 @@ const serverDebug = debug("server");
const ioDebug = debug("io");
const socketDebug = debug("socket");
require("dotenv").config(
process.env.NODE_ENV !== "development"
? { path: ".env.production" }
: { path: ".env.development" },
);
const app = express();
const port = process.env.PORT || 80; // default port to listen