add dotenv to server

This commit is contained in:
wancat committed 2024-01-29 13:21:33 +08:00
1 parent 7216158053
commit ba3b40792b
3 files changed
+10 -4

No files matched your search

+2 -1
View File
@@ -1,5 +1,6 @@
{
"watch": ["dist", "swagger.yaml", "../quests", "../packages"],
"ext": "js,ts,yaml,yml",
"exec": "node dist/index.js"
"exec": "node dist/index.js",
"delay": 200
}
+4 -3
View File
@@ -5,12 +5,12 @@
"type": "commonjs",
"scripts": {
"start": "node dist/index.js",
"dev": "concurrently \"yarn build -w\" \"nodemon\"",
"dev": "nodemon",
"test": "yarn node --experimental-vm-modules $(yarn bin jest)",
"setup": "node dist/cli/setup.js",
"clean": "node dist/cli/clean.js",
"build": "tsc --build",
"build:quests": "node src/cli/build.js"
"build": "tsc",
"build:quests": "node dist/cli/build.js"
},
"dependencies": {
"@linux-odyssey/constants": "*",
@@ -21,6 +21,7 @@
"commander": "^11.0.0",
"connect-mongo": "^5.0.0",
"dockerode": "^3.3.5",
"dotenv": "^16.4.1",
"express": "^4.18.2",
"express-rate-limit": "^7.1.3",
"express-session": "^1.17.3",
+4
View File
@@ -1,6 +1,10 @@
import validator from 'validator'
import { get } from './utils/env.js'
// Import dotenv and load ../.env
import dotenv from 'dotenv'
dotenv.config({ path: '../.env' })
function getTrustProxies(key) {
if (!process.env[key]) {
return []