diff --git a/package-lock.json b/package-lock.json index d457db1..5afbfd3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 63ff166..a3aed5e 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "main": "index.js", "license": "MIT", "dependencies": { + "dotenv": "^8.2.0", "express": "^4.17.1", "pg": "^8.2.1" }, diff --git a/src/config.ts b/src/config.ts index d9516d7..c6344bc 100644 --- a/src/config.ts +++ b/src/config.ts @@ -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);