Deploy your React website into Firebase hosting with environment variables

  Рет қаралды 3,107

Code Like Pro

Code Like Pro

Күн бұрын

Пікірлер: 25
@pranavmendiratta3166
@pranavmendiratta3166 2 жыл бұрын
Can you please explain a little bit what is env-cmd and how you used it to deploy your env variables? I am very confused. i tried searching about it but didn't find anything meaningful. Also any other way to add environment variables to deployed site on firebase?
@CodeLikePro22
@CodeLikePro22 2 жыл бұрын
it is just a package that injects your environment variables into your built version of your script, so when you push that built version into your firebase the keys are included. And unfortunately I don't know other ways.
@pranavmendiratta3166
@pranavmendiratta3166 2 жыл бұрын
@@CodeLikePro22 Ok, got it! Thanks 👍
@rogerprz
@rogerprz Жыл бұрын
Thank you really helped out.
@CodeLikePro22
@CodeLikePro22 Жыл бұрын
I am glad to hear that❤
@elmehdilahmidi6995
@elmehdilahmidi6995 2 жыл бұрын
Hello @Code Like Pro, Sorry, but I don't see the point of having environment variables if they will show up in the final build, anyone could just look up "apiKey" in the minified js and be able to see your keys!
@CodeLikePro22
@CodeLikePro22 2 жыл бұрын
I totally agree, but at least to hide them from normal users. To make firebase data secure, we need to focus on firebase rules. Project settings you can see them in the console logs or network traffic easily even if you hide them very well google will show them anyway
@someone9493
@someone9493 2 жыл бұрын
Thank you!
@CodeLikePro22
@CodeLikePro22 2 жыл бұрын
You are very welcome my friend
@drbv27
@drbv27 2 жыл бұрын
Hi, you need any library or package for use the ENV file?. talking for development initially..... how can i configure the deploy for update by github?
@CodeLikePro22
@CodeLikePro22 2 жыл бұрын
unfortunately Firebase doesn't have environment variables at least that I know. If you are going to use github for deployment you need to include your variables in your code
@tahaaslam9507
@tahaaslam9507 2 жыл бұрын
bro please make a video on ""connect a beautiful contact form with firebase 9''''.
@CodeLikePro22
@CodeLikePro22 2 жыл бұрын
We will do it soon in another coming projects
@AGriffith
@AGriffith 2 жыл бұрын
Hey one question, is it possible to make a deplay each time there is a push on my main branch even though I did the video process on my developer branch?
@CodeLikePro22
@CodeLikePro22 2 жыл бұрын
They have in their docs integration with github: firebase.google.com/docs/hosting/github-integration
@AGriffith
@AGriffith 2 жыл бұрын
I tried to do it, but I'm having problems with the command that you use of npm run build:deploy because there is no env.local file on the github repository, do you have discord?
@CodeLikePro22
@CodeLikePro22 2 жыл бұрын
@@AGriffith yes this way can't work with github. In github option, Firebase till now doesn't have a way to hide the keys as environment variables. So you have to put them in the config file directly
@CodeLikePro22
@CodeLikePro22 2 жыл бұрын
@@AGriffith for security, focus on the firebase rules to make your web app secure. I have a video on this channel how to make these rules
@timobrien4190
@timobrien4190 2 жыл бұрын
If you have issues using windows and have an error with firebase login use Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser Also if anyone is having an issue with firebase init not allowing you to load your projects try using firebase login --reauth . Thanks! And good luck all
@timobrien4190
@timobrien4190 2 жыл бұрын
Also make sure not to put your .env file in your src folder LOL
@CodeLikePro22
@CodeLikePro22 2 жыл бұрын
@@timobrien4190 Thanks a lot for sharing this important information
@AGriffith
@AGriffith 2 жыл бұрын
you are speaking too low, can barely hear you with max volume
@CodeLikePro22
@CodeLikePro22 2 жыл бұрын
thanks for this notice. we will try to fix it in the upcoming videos
@AGriffith
@AGriffith 2 жыл бұрын
@@CodeLikePro22 cool, nice vide by the way
@CodeLikePro22
@CodeLikePro22 2 жыл бұрын
@@AGriffith thanks bro
НИКИТА ПОДСТАВИЛ ДЖОНИ 😡
01:00
HOOOTDOGS
Рет қаралды 2,8 МЛН
НАШЛА ДЕНЬГИ🙀@VERONIKAborsch
00:38
МишАня
Рет қаралды 2,9 МЛН
My Daughter's Dumplings Are Filled With Coins #funny #cute #comedy
00:18
Funny daughter's daily life
Рет қаралды 35 МЛН
NestJS Configuration : Access  Environment Variables in Nestjs
14:46
НИКИТА ПОДСТАВИЛ ДЖОНИ 😡
01:00
HOOOTDOGS
Рет қаралды 2,8 МЛН