diff --git a/includes/config/Config.hpp b/includes/config/Config.hpp index a7b2b60..b1bbe47 100644 --- a/includes/config/Config.hpp +++ b/includes/config/Config.hpp @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/14 12:20:06 by adjoly #+# #+# */ -/* Updated: 2025/04/14 12:55:46 by adjoly ### ########.fr */ +/* Updated: 2025/04/14 13:36:42 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -27,7 +27,6 @@ class Config { std::vector *getServers(void) { return _servers; } private: - toml::ANode *_table; Logger *_log; std::vector *_servers; }; diff --git a/src/config/Config.cpp b/src/config/Config.cpp index 277313f..35eaec6 100644 --- a/src/config/Config.cpp +++ b/src/config/Config.cpp @@ -6,10 +6,11 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/14 12:53:54 by adjoly #+# #+# */ -/* Updated: 2025/04/14 13:32:56 by adjoly ### ########.fr */ +/* Updated: 2025/04/14 13:36:46 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ +#include "node/ANode.hpp" #include using namespace webserv::config; @@ -18,23 +19,23 @@ Config::Config(std::string &filename) { toml::Toml *file = new toml::Toml(filename); file->parse(); - _table = file->getParsedFile(); + toml::ANode *table = file->getParsedFile(); bool found = false; - void *logFile = _table->access("log_file", toml::STRING, found); + void *logFile = table->access("log_file", toml::STRING, found); if (found == true && logFile != not_nullptr) { _log = new Logger(*static_cast(logFile)); } else { _log = new Logger(); } - std::map *node = _table->getTable(); + std::map *node = table->getTable(); for (std::map::iterator it = node->begin(); it != node->end(); it++) { Server *srv = new Server(it->second, _log); _servers->push_back(srv); } - delete _table; + delete table; delete file; }