use vars to specify cors domain

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2023-02-28 22:04:30 +00:00
parent ac08243622
commit 976995e2a1
2 changed files with 4 additions and 3 deletions

View File

@ -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"));

View File

@ -6,5 +6,6 @@ const pveAPIToken = {
uuid: ""
};
const listenPort = 80;
const domain = "";
module.exports = {pveAPI, listenPort, pveAPIToken};
module.exports = {pveAPI, listenPort, pveAPIToken, domain};