I hope you loved this video! 🙂 📮Consider subscribing to my newsletter: codewithvlad.substack.com 🔥 And follow me on Twitter: twitter.com/vladimir_agaev
Thanks Vlad!! Finally, nobody else in other "tutorials" bothered mentioning you have to install the damned package dotenv package before you can use the env file, lol! Great tutorial, thanks again!
Liked and subscribed. This type of video is ideal for professional developers! I wanted to learn (quickly) how to use dotenv (over config) for storing variables for different environments. Your tutorial helped a lot!
Hey guys, if you liked this video please subscribe to my channel here: ua-cam.com/channels/jmouj0JizYt0qTI53TAtFg.html It will help me to make more tutorials!
Dotenv is just a library that will load the environment variables from a file (.env) into the memory of your app. You will have to be more specific with your question though as I don't know which database and which environment you want to use.
@@CodeWithVlad I'm still having a little bit of challenge, I tried requiring the dotenv in a nested file "formHandler.js" but didn't work. i.e the path to the file is src/client/js/formHandler.js. My code is : const path = require('path'); const apiKey = require("dotenv").config({ path: `${__dirname}/.env.${process.env.API_KEY}` });. Please help
@@ayinlaoluwafemi1993 you would do something like that const apiKey = require("dotenv").config({ path: path.resolve(__dirname, '../../../', `.env.${process.env.API_KEY}`) }); If you still have a problem post your github link
hi everyone if you are here for a react app don't install it it is already there create the .env and puti it in a .gitignore file as .env call it as the video without requiere it .
I am getting an error when don't provide NODE_ENV. Dont know if anyone used it with JEST TypeError: Cannot read properties of undefined (reading 'address') 16 | 17 | const response = await request(process.env.cognitoBaseUrl) > 18 | .post("/") | ^ 19 | .send(JSON.stringify(constants.adminLoginBody)) 20 | .set("Content-Type", "application/x-amz-json-1.1") 21 | .set("Connection", "Close") at Test.serverAddress (node_modules/supertest/lib/test.js:46:22) at new Test (node_modules/supertest/lib/test.js:34:14) at Object.post (node_modules/supertest/index.js:28:14) at Object.generateUserTokens (newWorldSetup.js:18:12) at jest.setup.js:11:23
This is a really dumb question but what's the point if you have to have a .env file there that has your .env-variables (e.g. password) exposed anyways?
APPLE COMPUTER = WINDOWS USERS following this tutorial will be at a loss and say "why mine doesnt work with NODE_ENV=development" Windows user will be lost when NODE_ENV=development Must npm install cross-env then in package.json "buildDev": "cross-env NODE_ENV=development node server" //assuming u have ".env.development" file and "server.js" is the target file
I hope you loved this video! 🙂
📮Consider subscribing to my newsletter: codewithvlad.substack.com
🔥 And follow me on Twitter: twitter.com/vladimir_agaev
Низкий тебе поклон, чувак. Спасибо!) Твоё видео это та самая жемчужина на просторах интернета
Thanks vlad i passed trough 10 videos before coming here and just u explained what i need
Thanks Vlad!! Finally, nobody else in other "tutorials" bothered mentioning you have to install the damned package dotenv package before you can use the env file, lol! Great tutorial, thanks again!
:)
isn't that like pretty obvious? lol
Accurate and to the point! Very nice video!
Liked and subscribed. This type of video is ideal for professional developers! I wanted to learn (quickly) how to use dotenv (over config) for storing variables for different environments. Your tutorial helped a lot!
Awesome, thank you!
Short and to the point! Thanks!
Glad it helped!
Thanks, implemented in our project with your help.
Precisely crisp and clear!! That's what is a perfect coding tutorial should be like. 👍👍 Liked and subscribed.
Crystal clear explanation!! Thank You Brother!!
You are very welcome
Very clear! Thank you!
thanks you so much Vlad, u are so quickly to explain .env
Thanks so much
very straight forward and easy
many thanks
Great video vlad. Thanks!
Excellent tutorial thanks a lot!
Hey guys, if you liked this video please subscribe to my channel here: ua-cam.com/channels/jmouj0JizYt0qTI53TAtFg.html
It will help me to make more tutorials!
Gorgeous explanation!
Glad it was helpful!
Thank you so much for this
Thank you Vlad!
Nice content Vlad. Really informative.
Thank you Clyde :)
Thank you so much!!
Great explanation…
awesome explanation.
wanna ask, if you deploy to UAT or etc, should the .env copy to the server?
.env should be on the server but not in your repository if that makes sense.
what is the theme that you use for the VSCode ? and how did change the Terminal fonts and colors ..?
The theme is material ui, with material icons :)
And terminal is ohmyz.sh/
What VsCode theme you use?
Material Theme!
Is there anyone anywhere who can tell us how to do this with ES6 modules?
What are the advantages of building with dotenv vs building with envs in docker compose?
How can I change the environment variables from database query ?
Dotenv is just a library that will load the environment variables from a file (.env) into the memory of your app. You will have to be more specific with your question though as I don't know which database and which environment you want to use.
Is there a way to update an existing env variable, for example an access token?
yes, process.env.VARIABLE = value;
Tres clair, merci
keep up the good work Vlad. Please how am I going to require dotenv in a file which is in a nested folder.
3:54, add your nested folder just after the __dirname
@@CodeWithVlad I'm still having a little bit of challenge, I tried requiring the dotenv in a nested file "formHandler.js" but didn't work. i.e the path to the file is src/client/js/formHandler.js. My code is : const path = require('path'); const apiKey = require("dotenv").config({
path: `${__dirname}/.env.${process.env.API_KEY}`
});. Please help
my outputs are undefined
@@ayinlaoluwafemi1993 you would do something like that const apiKey = require("dotenv").config({
path: path.resolve(__dirname, '../../../', `.env.${process.env.API_KEY}`)
}); If you still have a problem post your github link
hi everyone if you are here for a react app don't install it it is already there create the .env and puti it in a .gitignore file as .env
call it as the video without requiere it .
in windows for node_env=development is not working, why ?
I am getting an error when don't provide NODE_ENV.
Dont know if anyone used it with JEST
TypeError: Cannot read properties of undefined (reading 'address')
16 |
17 | const response = await request(process.env.cognitoBaseUrl)
> 18 | .post("/")
| ^
19 | .send(JSON.stringify(constants.adminLoginBody))
20 | .set("Content-Type", "application/x-amz-json-1.1")
21 | .set("Connection", "Close")
at Test.serverAddress (node_modules/supertest/lib/test.js:46:22)
at new Test (node_modules/supertest/lib/test.js:34:14)
at Object.post (node_modules/supertest/index.js:28:14)
at Object.generateUserTokens (newWorldSetup.js:18:12)
at jest.setup.js:11:23
if we create env , is secure ? running on apk ? i have .env encrypt, running login success on simulator but not working on apk
Succinct explanation.
This is a really dumb question but what's the point if you have to have a .env file there that has your .env-variables (e.g. password) exposed anyways?
How are you able to use multiple .env files?
I show it in the video bro
nice!
someone tell me how to make the terminal autocomplete for me like in the video what the hack ?!
APPLE COMPUTER = WINDOWS USERS following this tutorial will be at a loss and say "why mine doesnt work with NODE_ENV=development"
Windows user will be lost when NODE_ENV=development
Must npm install cross-env
then in package.json "buildDev": "cross-env NODE_ENV=development node server" //assuming u have ".env.development" file and "server.js" is the target file