Skip to content

Commit

Permalink
Merge branch 'master' of github.com:renatodellosso/market-pulse
Browse files Browse the repository at this point in the history
  • Loading branch information
renatodellosso committed Sep 26, 2024
2 parents 406fdde + 6e64a17 commit bde4fa6
Show file tree
Hide file tree
Showing 2 changed files with 5,601 additions and 5,571 deletions.
11 changes: 8 additions & 3 deletions backend/envloader.mts
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import * as dotenv from "dotenv";
import path from "path";

export function loadEnv() {
console.log("Loading environment variables...");

dotenv.config({
path: __dirname + "/../.env.backend",
const result = dotenv.config({
path: path.resolve(__dirname, "../.env")
});

if (result.error) {
throw result.error;
}

// Check if all environment variables are set
if (!process.env.MONGODB_URI)
throw new Error("MONGO_URI environment variable not set");
throw new Error("MONGODB_URI environment variable not set");
if (!process.env.EMAIL_USERNAME)
throw new Error("EMAIL_USERNAME environment variable not set");
if (!process.env.EMAIL_PASSWORD)
Expand Down
Loading

0 comments on commit bde4fa6

Please sign in to comment.