-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
39 lines (33 loc) · 782 Bytes
/
Copy pathmain.cpp
File metadata and controls
39 lines (33 loc) · 782 Bytes
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
#include "./includes/Libs.hpp"
void handleStop(int signal);
WebServ webServer;
int main(int argc, char *argv[]){
const char* confPath;
if(argc > 2) {
Logs::printLog(Logs::ERROR, 0, "Number of invalid arguments!");
return (1);
}
if(argc ==2){
confPath = argv[1];
}else{
confPath = "./config/default.conf";
}
if(!CheckFile::check(confPath))
return(1);
signal(SIGINT, handleStop);
if(!webServer.setDataServer(confPath)){
Logs::printLog(Logs::ERROR, 1, "Erro set data server");
return(1);
}
if(!webServer.connect()){
Logs::printLog(Logs::ERROR, 1, "Error when trying to connect");
return(1);
}
return(webServer.start());
}
void handleStop(int signal){
if (signal == SIGINT) {
Logs::printLog(Logs::INFO, 3, "Stop server :(");
std::exit(0);
}
}