From b970e990a61bae0aa42c59a6d2bc2b959f65eb82 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Tue, 28 Feb 2023 22:04:30 +0000 Subject: [PATCH] use vars to specify cors domain Signed-off-by: Arthur Lu --- main.js | 4 ++-- vars.js.template | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index 9fc7d2d..5bb4902 100644 --- a/main.js +++ b/main.js @@ -7,14 +7,14 @@ const morgan = require("morgan"); const axios = require('axios'); var api = require("./package.json"); -const {pveAPI, pveAPIToken, listenPort} = require("./vars.js"); +const {pveAPI, pveAPIToken, listenPort, domain} = require("./vars.js"); const {init, requestResources, releaseResources} = require("./db.js"); const app = express(); app.use(helmet()); app.use(bodyParser.urlencoded({extended: true})); app.use(cookieParser()) -app.use(cors({origin: "https://client.tronnet.net"})); +app.use(cors({origin: domain})); app.use(morgan("combined")); diff --git a/vars.js.template b/vars.js.template index 4f652a0..41c283d 100644 --- a/vars.js.template +++ b/vars.js.template @@ -6,5 +6,6 @@ const pveAPIToken = { uuid: "" }; const listenPort = 80; +const domain = ""; -module.exports = {pveAPI, listenPort, pveAPIToken}; \ No newline at end of file +module.exports = {pveAPI, listenPort, pveAPIToken, domain}; \ No newline at end of file