mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-05-10 16:58:46 +02:00
「🔨」 fix: fixed issue with tomlpp
This commit is contained in:
@ -25,15 +25,15 @@ cgi.go = "/bin/go"
|
||||
[server.location./redir]
|
||||
redirect = "https://kanel.ovh"
|
||||
|
||||
[server1]
|
||||
[server3]
|
||||
server_names = { "ptnnnn.local"}
|
||||
host = "0.0.0.0"
|
||||
port = 90
|
||||
host = "127.0.0.2"
|
||||
port = 9090
|
||||
|
||||
[server1.error_pages]
|
||||
[serverr.error_pages]
|
||||
404 = "existepasfd***.html"
|
||||
|
||||
[server1.location./]
|
||||
[serverr.location./]
|
||||
methods = { "GET", "DELETE" }
|
||||
root = "/var/lib/docker/volumes/test_data/_data"
|
||||
dirlist = false
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/14 12:53:54 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/22 15:35:52 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/23 17:42:07 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -15,13 +15,19 @@
|
||||
#include "cppeleven.hpp"
|
||||
#include "node/ANode.hpp"
|
||||
#include <config/default.hpp>
|
||||
#include <stdexcept>
|
||||
|
||||
using namespace webserv::config;
|
||||
|
||||
Config::Config(std::string &filename) {
|
||||
toml::Toml *file = new toml::Toml(filename);
|
||||
|
||||
file->parse();
|
||||
try {
|
||||
file->parse();
|
||||
} catch (std::runtime_error &e) {
|
||||
delete file;
|
||||
throw e;
|
||||
}
|
||||
toml::ANode *table = file->getParsedFile();
|
||||
|
||||
bool found = false;
|
||||
@ -36,8 +42,13 @@ Config::Config(std::string &filename) {
|
||||
for (auto it = prange(node)) {
|
||||
if (it->second->type() == toml::TABLE) {
|
||||
_log->info("taking server from table : " + it->first);
|
||||
Server *srv = new Server(it->second);
|
||||
_servers.push_back(srv);
|
||||
try {
|
||||
Server *srv = new Server(it->second);
|
||||
_servers.push_back(srv);
|
||||
} catch (std::runtime_error &e) {
|
||||
_log->error(e.what());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete table;
|
||||
|
Reference in New Issue
Block a user