Add support for dotenv#94
Merged
Merged
Conversation
DZakh
approved these changes
Jul 30, 2024
| engines: {node: '>=0.3.1'} | ||
| dev: false | ||
|
|
||
| /dotenv@16.4.5: |
Member
There was a problem hiding this comment.
Looks like you have pnpm v6 or something like this. Let's all use pnpm v9, so there are no conflicts with the pnpm lock file.
| "dotenv": "16.4.5", | ||
| "ethers": "6.8.0", | ||
| "express": "4.19.2", | ||
| "handlers": "{{relative_path_to_root_from_generated}}", |
Member
There was a problem hiding this comment.
Let's rename it to the root; handlers confused me when I was reviewing the code 😅
| @@ -1,4 +1,6 @@ | |||
| // %%raw(`globalThis.fetch = require('node-fetch')`) | |||
Comment on lines
+1
to
+3
| type requireObj = {resolve: string => string} | ||
| external requireObj: requireObj = "require" | ||
| let _res = Dotenv.config({path: requireObj.resolve("handlers/.env")}) |
Member
There was a problem hiding this comment.
Is it needed here since you already added it to the Index.res?
Collaborator
Author
There was a problem hiding this comment.
I will tidy this up. It's needed because Index.res is not called when running the testing framework.
And I wanted it on Index.res since I think there is a few env var lookups there as well.
Collaborator
Author
There was a problem hiding this comment.
Also realised this will error if .env does not exist so will fix that now.
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 https://linear.app/envio/issue/IDX-597/add-automatic-env-file-support-to-the-indexer