-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
45 lines (42 loc) · 1.4 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yjorus <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/24 13:30:39 by yjorus #+# #+# */
/* Updated: 2023/10/24 13:30:40 by yjorus ### ########.fr */
/* */
/* ************************************************************************** */
#include "inc/AllHeaders.hpp"
#include "inc/Webserv.hpp"
#include "inc/RunServer.hpp"
int main(int ac, char **av)
{
if (ac == 1 || ac == 2)
{
Webserv webserv;
RunServer run;
try
{
if (ac == 2)
webserv.config(av[1]);
else
webserv.config("example_config");
run.setupServers(webserv.getServers());
}
catch (std::exception &e)
{
std::cerr << e.what() << std::endl;
return (1);
}
run.serverLoop();
}
else
{
std::cerr << "Invalid number of arguments!" << std::endl;
return (1);
}
exit (0);
}