-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: Early dotenv We need to call `dotenv.config()` before other files are imported to have the .env configuration take effect in NODE_ENV=production. * fix: Reorder imports
- Loading branch information
1 parent
594e760
commit c66d77c
Showing
2 changed files
with
14 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import dotenv from "dotenv"; | ||
import { getLogger } from "./logger/index.js"; | ||
|
||
const logger = getLogger("lib/env"); | ||
logger.info("Starting in NODE_ENV=" + process.env.NODE_ENV); | ||
|
||
// The dev server parses keys in non-production | ||
if (process.env.NODE_ENV === "production") { | ||
const config = dotenv.config(); | ||
logger.info( | ||
"Parsed .env file with keys: " + Object.keys(config.parsed ?? {}).join(","), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters