Adding dependency to load variables from .env file
parent
48ecf478f7
commit
3015eeb262
|
@ -491,6 +491,11 @@
|
|||
"is-obj": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"dotenv": {
|
||||
"version": "8.2.0",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
|
||||
"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw=="
|
||||
},
|
||||
"duplexer3": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dotenv": "^8.2.0",
|
||||
"express": "^4.17.1",
|
||||
"pg": "^8.2.1"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
require('dotenv').config()
|
||||
|
||||
if (!process.env.PORT) {
|
||||
console.log("Missing environment variable PORT");
|
||||
process.exit(1);
|
||||
console.log("Missing environment variable PORT");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
export const port: number = parseInt(process.env.PORT as string, 10);
|
||||
|
|
Loading…
Reference in New Issue