WEBVTT

00:03.700 --> 00:04.690
Hey, did everyone.

00:04.820 --> 00:05.430
They sure.

00:05.440 --> 00:10.570
And let's go ahead and talk about one by one all of these problems, starting with the very easiest

00:10.570 --> 00:12.250
one, which is hiding the secret.

00:12.280 --> 00:14.590
You all know, hiding the secret is really important.

00:14.590 --> 00:18.610
And this is how your entire application is going to be safeguarded through the variety of attacks,

00:18.610 --> 00:24.850
as well as some sensitive information that should always be available just with your back and even securely

00:24.850 --> 00:25.420
to your back.

00:25.420 --> 00:30.640
And also and we have seen that in one of the first videos or first section that there is a configurable

00:30.640 --> 00:33.130
section and you'll find this section everywhere.

00:33.130 --> 00:35.200
It's not just about Heroku, it's about digital.

00:35.200 --> 00:35.530
Okay?

00:35.530 --> 00:40.780
And eight of us, they all give you access to some kind of safe storage, which is secure, and your

00:40.780 --> 00:44.350
application just access them through some of these processes.

00:44.350 --> 00:48.610
Now, majority of the time, you're going to see that they always gives you like this process and then

00:48.610 --> 00:49.930
the name of the variable.

00:49.930 --> 00:54.880
And here also you see that the name of the variables are being defined and you just put up the value.

00:54.910 --> 00:57.340
You don't define the port just like we have defined it.

00:57.340 --> 01:02.650
But you saw that we were writing process and now this is the time we study more about in depth of that.

01:02.830 --> 01:07.180
First thing you might have noticed that everything is in the caps, in the config variable part there

01:07.180 --> 01:08.620
is available and there is a value.

01:08.620 --> 01:10.690
So I'm going to call this one as available.

01:10.810 --> 01:13.540
GitHub username is there and there are other variables.

01:13.540 --> 01:15.910
There can be backend URL, there is some secret.

01:15.910 --> 01:21.460
So this is all usually written in the all uppercase, not compulsory, but this is how we majorly do

01:21.460 --> 01:21.790
it.

01:21.820 --> 01:23.830
So how we can go ahead and do this.

01:23.830 --> 01:28.600
Now, there are not too many of the ten options that are being used by the industry majority of the

01:28.600 --> 01:28.840
time.

01:28.840 --> 01:35.380
In fact, like 99.9% of the time you'll be using D and V, you can actually use some of the other packages

01:35.380 --> 01:40.960
or write to custom your own, but it doesn't really make sense to not use what everybody is using.

01:40.960 --> 01:42.760
So this is the package that we'll be using.

01:42.760 --> 01:48.400
So if you'll open up this package, this is the variable of library you are going to see or the package.

01:48.400 --> 01:52.660
And you can see by the weekly download that this is an insanely crazy popular library.

01:52.660 --> 01:53.770
Everybody uses this.

01:53.770 --> 01:55.270
Yeah, this is the popularity of it.

01:55.300 --> 01:58.930
In just week this many downloads and it was published five months ago.

01:58.930 --> 02:03.970
It's not the new one, it's the published date actually when the recent publish of this version was

02:03.970 --> 02:04.360
published.

02:04.360 --> 02:09.130
If you're going to look for the versions, you're going to see that this is like really long popular

02:09.130 --> 02:12.130
library around eight years ago and still to this date.

02:12.130 --> 02:13.870
Well, the most industry standard.

02:14.470 --> 02:15.010
Okay.

02:15.130 --> 02:16.780
Moving back on to this dot envy.

02:16.780 --> 02:17.680
Let's go ahead.

02:17.680 --> 02:19.630
Now, we can install it pretty easily.

02:19.750 --> 02:21.040
We're not going to do it right now.

02:21.040 --> 02:23.590
We'll have a separate starting of the project itself.

02:23.590 --> 02:25.690
Right now, we just want to study the theory part.

02:25.690 --> 02:27.520
So this is the this is that one.

02:27.520 --> 02:33.370
So we're going to just go ahead and grab and PMI or dot, dot, E and V, that's the package name.

02:33.370 --> 02:34.720
That's all you have to install.

02:34.720 --> 02:40.180
And then comes up the part is the usage which is required and v now I'll show you a little bit more

02:40.180 --> 02:45.010
and I'll give you the snippets of that so that you can easily access them via the presentation itself.

02:45.010 --> 02:50.170
But notice here again, as I mentioned that the DB underscore host, this is how the variable name is

02:50.170 --> 02:53.080
being displayed and after that you use just the local host.

02:53.080 --> 02:54.160
Now a couple of things.

02:54.160 --> 02:58.960
Keep in mind that in the value you just write whatever is there, you don't use double codes for string

02:58.960 --> 03:01.480
or anything, a special format for numbers.

03:01.480 --> 03:07.000
You just simply declare all in uppercase by the standards are the name of the variable and by equal

03:07.000 --> 03:08.830
you just use whatever is there.

03:08.830 --> 03:11.260
It can be a string, it can be a URL, whatever is there.

03:11.260 --> 03:13.120
You just paste it directly as it is.

03:13.120 --> 03:14.380
So this is one thing.

03:14.890 --> 03:20.620
Now we also saw that just like we were using a const express equals required express.

03:20.800 --> 03:24.430
Since we don't hold this into a variable, you just need to have this file available.

03:24.430 --> 03:28.840
And once this is available, you can just write processed E and V wherever this is being declared,

03:28.840 --> 03:33.340
you can write a processed E and V and whatever the name of the variable is.

03:33.400 --> 03:38.410
Now notice here it says config, but this config is a little bit more tricky to work on with because

03:38.410 --> 03:40.300
there are a couple of syntax that may come in.

03:40.300 --> 03:42.400
So I want you to just introduce with them.

03:42.400 --> 03:47.350
So majority of the case, if the dot env file, of course you have to create a new file in your project

03:47.350 --> 03:47.740
directory.

03:47.740 --> 03:52.330
We will do this all of the practical, but I just want to make sure your journey is absolutely smooth

03:52.330 --> 03:56.590
with a constant grace grasp over the theory itself.

03:56.590 --> 04:03.130
So you usually write require dot and V as a config, but sometimes in some cases you put that env file

04:03.130 --> 04:06.250
into some special folder, maybe a config folder or something.

04:06.250 --> 04:11.260
In that case, you have to pass on an object in this config and have to say that the path of loading

04:11.260 --> 04:14.890
this environment variable is located up here wherever that path is.

04:14.890 --> 04:20.350
And usually we prefer to put this put this entire path relative to the home directory.

04:20.350 --> 04:21.310
But again, it's up to you.

04:21.310 --> 04:23.380
You want to use dot, dot, slash, go ahead and use that.

04:23.380 --> 04:24.550
There is no issue in that.

04:24.670 --> 04:28.780
Now, there are more options available in this one, but you don't need to know too much about them.

04:28.780 --> 04:32.530
And this actually solves us the problem of hiding the secrets.

04:32.530 --> 04:33.730
So one problem is solved.

04:33.730 --> 04:36.370
Let's go ahead and move on to the next problems that we have.
