From a55b9a58d7e75b06961c306a4b600faeb02d6ce0 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Thu, 16 Nov 2023 23:26:11 +0000 Subject: [PATCH] move listenPort option to argv --- config/template.localdb.json | 1 - src/main.js | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/template.localdb.json b/config/template.localdb.json index 4ea6473..80416af 100644 --- a/config/template.localdb.json +++ b/config/template.localdb.json @@ -20,7 +20,6 @@ "username": "root@pam", "password": "rootpassword" }, - "listenPort": 80, "hostname": "paas.mydomain.example", "domain": "mydomain.example" }, diff --git a/src/main.js b/src/main.js index c68eabf..27bae64 100644 --- a/src/main.js +++ b/src/main.js @@ -12,6 +12,7 @@ import parseArgs from "minimist"; global.argv = parseArgs(process.argv.slice(2), { default: { package: "package.json", + listenPort: 80, db: "./localdb.js", // relative to main.js dbconfig: "config/localdb.json" } @@ -30,8 +31,8 @@ app.use(cookieParser()); app.use(cors({ origin: global.db.hostname })); app.use(morgan("combined")); -global.server = app.listen(global.db.listenPort, () => { - console.log(`proxmoxaas-api v${global.api.version} listening on port ${global.db.listenPort}`); +global.server = app.listen(global.argv.listenPort, () => { + console.log(`proxmoxaas-api v${global.api.version} listening on port ${global.argv.listenPort}`); }); global.utils.recursiveImport(app, "/api", "routes");