Lesson 5: How the system recognize PRIVATE_KEY_PASSWORD on command line as part of .env if we deleted it? #1591
-
Why The code below in my understanding is saying: process env to check for the PRIVATE_KEY_PASSWORD, isn't it? Like, check for the PRIVATE_KEY_PASSWORD on .env file? let wallet = new ethers.Wallet.fromEncryptedJsonSync(
encryptedJson,
process.env.PRIVATE_KEY_PASSWORD
); but there's no PRIVATE_KEY_PASSWORD there since we deleted it. How typing PRIVATE_KEY_PASSWORD=password on command line add it to .env? Video part: https://youtu.be/gyMwXuJrbJQ?t=28050 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey, I think you got it wrong
You can set Now, coming to Conclusion : To use |
Beta Was this translation helpful? Give feedback.
Hey, I think you got it wrong
process.env
does not read the.env
file and populates the fields.You can set
env
property while running a particular node fileexample :
NAME=SHIV node deploy.js
this populatesprocess.env.NAME
withSHIV
Now, coming to
.env file
, To populate the variables from this file we have used apackage
calleddotenv
and we have configured it at the start of our script. Thisdotenv
is what takes your variables from.env file
and add them toprocess.env
.Conclusion :
You can always set
env
property without.env
fi…