still working on integrating the config file stuff

This commit is contained in:
Me
2022-07-25 21:00:04 +02:00
parent b9ccf09089
commit 35ac55b5e8
9 changed files with 142 additions and 36 deletions

View File

@@ -4,11 +4,21 @@
#include <stdexcept>
#include <Webserv.hpp>
int main(void)
int main(int ac, char **av)
{
try
{
Webserv serv;
std::string config = (ac == 2 ? av[1] : "./default.config");
// like this just looks kinda gross, why bother creating an instance
// and not immediately parsing? like it servers no other purpose...
// what if i call parse directly in the constructor?
// oh because the constructor has no return, but still
// is there a better way?
ConfigParser configParser(config.c_str());
Webserv serv(configParser.parse());
// is this better or worse than using
serv.init_virtual_servers();
serv.start();