You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
869 B

#include "webserv.hpp"
2 years ago
#include "json/Parser.hpp"
#include "load/Env.hpp"
2 years ago
int main(int ac, char **av) {
Env env;
if (ac > 1) {
cout << "Parsing configuration file...\n";
JSONParser parser(av[1]);
JSONNode *conf = parser.parse();
cout << "Configuration parsed.\n";
cout << "Setting environment...\n";
env.max_clients = conf->obj()["max_clients"]->nbr();
JSONList servers = conf->obj()["servers"]->lst();
2 years ago
int i = 0;
string th[8]= {"first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eigth"};
for (std::vector<JSONNode *>::iterator it = servers.begin();
it < servers.end(); it++) {
Server *server = new Server(*it);
delete *it;
server->launch();
cout << th[i] << " server launched.";
i++;
}
delete conf;
2 years ago
}
return (0);
}