feat(sdk): load .env from project root#3971
Merged
timsuchanek merged 8 commits intomasterfrom Oct 21, 2020
Merged
Conversation
378118b to
4727134
Compare
6d03e3b to
92a5c76
Compare
Jolg42
reviewed
Oct 21, 2020
Jolg42
reviewed
Oct 21, 2020
Jolg42
reviewed
Oct 21, 2020
Jolg42
reviewed
Oct 21, 2020
Contributor
|
I will need to play with it locally I think to get the full experience |
6efc55d to
4467b53
Compare
Jolg42
reviewed
Oct 21, 2020
b9fd5f5 to
0a1b3cc
Compare
Contributor
|
Once this is green, we can merge :) |
Co-authored-by: Joël Galeran <Jolg42@users.noreply.github.com>
Co-authored-by: Joël Galeran <Jolg42@users.noreply.github.com>
0a1b3cc to
f3af22f
Compare
|
|
||
| /** | ||
| * Tries load env variables | ||
| * 1. Load .env from project root |
Contributor
There was a problem hiding this comment.
The order in the code seems different? It seems like "Load .env from project root" happens last?
Author
There was a problem hiding this comment.
Yeah this needs to be updated I thought I had
| schemaEnvPathFromArgs, // 1 - Check --schema directory for .env | ||
| schemaEnvPathFromPkgJson, // 2 - Check package.json schema directory for .env | ||
| './prisma/.env', // 3 - Check ./prisma directory for .env | ||
| './.env' // 4 - Check cwd for .env |
Contributor
There was a problem hiding this comment.
I might have missed something, but for 4, I think we'd want to check the same dir as where your package.json resides, rather than cwd.
Author
There was a problem hiding this comment.
The logic for loading the env var from your project root would cover that case.
Author
There was a problem hiding this comment.
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 #3720
How it will work
.envfrom project root.envfrom possible schema locations and throw if there are env clashes with root.env--schema"prisma": {"schema": "/path/to/schema.prisma"}./prisma/.envTODO
.envconflicts