1
00:00:01,940 --> 00:00:06,980
In this lecture, we're going to take a look at how you can define your own variables in Gittel website.

2
00:00:10,490 --> 00:00:17,030
You probably have noticed that we now have this domain name all over the place here, so we now have

3
00:00:17,030 --> 00:00:23,630
to insist on staging and this is defined in an environment and again here and again in testing and so

4
00:00:23,630 --> 00:00:23,840
on.

5
00:00:24,590 --> 00:00:30,370
So definitely every time you have something that you have to duplicate all over the place, and especially

6
00:00:30,380 --> 00:00:31,850
with something that can change.

7
00:00:33,300 --> 00:00:36,540
It is generally not a good idea to replicate it all over.

8
00:00:37,440 --> 00:00:39,960
And here comes the concept of variables.

9
00:00:40,350 --> 00:00:46,320
Now, if we remember all variables, we have used variables in the past and we have to use them actually

10
00:00:46,320 --> 00:00:47,500
to start to cigarettes.

11
00:00:47,790 --> 00:00:53,970
And as you remember, you can configure your own variables if you go to settings ICD and go over to

12
00:00:53,970 --> 00:00:54,570
variables.

13
00:00:56,430 --> 00:00:59,850
I previously said that this is a good idea to store your secrets here.

14
00:01:00,320 --> 00:01:05,000
Now, it doesn't mean that you can only store secrets here.

15
00:01:05,010 --> 00:01:12,030
So like the search, login and search token, you can actually store anything that you like.

16
00:01:12,840 --> 00:01:19,110
And one idea would be to store the domain names here and you can definitely do that and then simply

17
00:01:19,110 --> 00:01:20,490
reference them in the scripts.

18
00:01:20,760 --> 00:01:27,480
This will keep the configuration of your pipelines or the name of the remains separated from your code,

19
00:01:27,780 --> 00:01:28,800
from your code base.

20
00:01:30,120 --> 00:01:36,930
But you can define these variables in your pipeline and maybe later decide what you want to do with

21
00:01:36,930 --> 00:01:39,530
them, which one is, in your case, the best approach.

22
00:01:39,750 --> 00:01:44,220
Nevertheless, I think we can agree that it is not a good idea to duplicate stuff.

23
00:01:44,700 --> 00:01:50,430
So in this lecture, I'm going to show you how you can define variables in your catalepsy pipeline.

24
00:01:55,250 --> 00:02:01,730
Now, as with many things, you can define variables either directly in your job so that you can reuse

25
00:02:01,730 --> 00:02:02,680
something in your job.

26
00:02:02,690 --> 00:02:07,850
For example, if I would put this in a variable, then I could use it here and here.

27
00:02:08,479 --> 00:02:17,390
But as this is needed later, at least for the production is listed here in order to run the production

28
00:02:17,390 --> 00:02:21,530
test, it definitely makes sense to define this on a global level.

29
00:02:26,700 --> 00:02:28,710
Well, let's go here and define variables.

30
00:02:36,430 --> 00:02:42,730
And I'm going to keep it very simple, I'm going to name it staging domain.

31
00:03:02,110 --> 00:03:03,340
And production domain.

32
00:03:11,450 --> 00:03:14,570
Of course, you are totally free to name them as you like.

33
00:03:18,350 --> 00:03:21,340
So let's go and change our configuration as well.

34
00:03:42,160 --> 00:03:43,360
And for production.

35
00:04:01,990 --> 00:04:03,530
Now we need to change it here as well.

36
00:04:04,000 --> 00:04:08,950
So now we have the staging domain and a production domain and hopefully we don't have anything with

37
00:04:08,960 --> 00:04:10,660
search anymore in our code.

38
00:04:17,550 --> 00:04:20,000
OK, so these are the only two occurrences.

39
00:04:20,670 --> 00:04:26,190
Now, the good news is that if you decide to move them outside your normal configuration file, you

40
00:04:26,190 --> 00:04:29,340
can easily do so or otherwise.

41
00:04:29,340 --> 00:04:34,740
If you need to change these domains, you can do that as well from here quite easily.

42
00:04:38,720 --> 00:04:42,080
So let's committees and see if our pipeline still works the same.

43
00:04:47,400 --> 00:04:52,890
So it seems that everything works perfectly because the pipeline still runs, actually, because we

44
00:04:52,890 --> 00:04:58,260
have all this test, especially in our case, the production test, we can actually make sure that the

45
00:04:58,260 --> 00:05:03,120
changes that we make to the pipeline, especially when it comes to configuration stuff, that they actually

46
00:05:03,120 --> 00:05:08,130
work and they give us this feeling that much whatever we do with the pipeline, we still have a working

47
00:05:08,130 --> 00:05:09,150
and functional pipeline.

48
00:05:10,080 --> 00:05:16,050
So this is how you can use variables for your domain names or for everything or for anything else that

49
00:05:16,050 --> 00:05:17,110
could actually change.

50
00:05:17,550 --> 00:05:23,760
And as I said, the indicator for such things that need to be in a variable is when you start repeating

51
00:05:23,760 --> 00:05:30,840
yourself and you start adding configuration and putting something in a lot of places in your getler

52
00:05:30,910 --> 00:05:31,830
configuration file.

