Feature/unify env loader#366
Open
Devadakene wants to merge 7 commits into
Open
Conversation
Contributor
|
Awesome work on this! Thanks for the contribution 🚀 Merging now. |
Contributor
|
Hi 👋 Thanks for this PR! There are some merge conflicts with the current main. Could you rebase onto main and push when you have a moment? Once it's clean we'll get it merged 🚀 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #255
Summary
This PR consolidates and unifies the environment file resolution logic. Previously,
.envfile resolution was duplicated in bothmain.tsandapp.module.tswith minor differences in search order, introducing potential configuration drift between application bootstrap and Nest module initialization.A new
loadEnv()helper has been introduced insrc/common/utils/env-loader.tsto unify the candidate search order and loading. Both entry points now call this helper.OS environment variables take precedence over dotenv variables (default
dotenvbehavior), which has been documented.Testing
Tested using unit tests in
test/env-loader.spec.tsto assert that both call paths agree on the resolved path and load variables consistently.bun test test/env-loader.spec.tsOutput:
Screenshots
Checklist