🏗️」 wip: Started reading subject

This commit is contained in:
2025-03-19 15:52:31 +01:00
parent 14bc77ab56
commit 43df2b18a7
9 changed files with 146 additions and 13 deletions

5
.clang-format Normal file
View File

@ -0,0 +1,5 @@
UseTab: Always
IndentWidth: 4
TabWidth: 4
AlignConsecutiveDeclarations: true
ConstructorInitializerIndentWidth: 4

View File

@ -1,21 +1,37 @@
[server] [server]
server_names = { "localhost", "2B5.local" } # can be a array or a str server_names = { "localhost", "2B5.local" }
port = { 8080, 8090 } # can be a array or a int host = "localhost"
port = 8080
root = "/nfs/adjoly/workspace/kanel.ovh"
max_post_size = "10M"
cookies = true
uploads = false
dirlist = true
root = "/var/www/html"
methods = { "GET", "POST", "DELETE" } methods = { "GET", "POST", "DELETE" }
index = "index.html"
[server.error_page] dirlist = false
uploads = false
cookies = false
cgi_path = "/bin/php"
cgi_ext = ".php"
client_max_body_size = "10M"
[server.error_pages]
404 = "not_found.html" 404 = "not_found.html"
401 = "unauthorized.html" 401 = "unauthorized.html"
402 = "uwu.html" 402 = "uwu.html"
[server.cgi] [server.location./]
py = "/usr/bin/python3" methods = { "GET" }
root = "/var/www/html"
dirlist = true
[server.location./api]
methods = { "GET", "POST" }
uploads = true
root = "/var/www/api"
upload_path = "/etc/webserv/up"
cgi_path = "/bin/go"
cgi_ext = ".go"
[server.location./redir]
redirect = "https://kanel.ovh"

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* AConfig.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/19 14:11:28 by adjoly #+# #+# */
/* Updated: 2025/03/19 14:27:56 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include <map>
#include <string>
#include <vector>
class AConfig {
public:
protected:
private:
std::vector<std::string> serverNames;
std::map<std::string, std::string> cgi;
};

View File

@ -0,0 +1,15 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ARoute.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/19 14:59:41 by adjoly #+# #+# */
/* Updated: 2025/03/19 15:52:16 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
class Route {
};

View File

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ParsedConfig.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/19 14:11:28 by adjoly #+# #+# */
/* Updated: 2025/03/19 15:52:16 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
class config {
public:
protected:
private:
std::map cgi;
};

32
includes/config/Route.hpp Normal file
View File

@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Route.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/19 14:59:41 by adjoly #+# #+# */
/* Updated: 2025/03/19 15:52:16 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include <string>
namespace webserv {
namespace config {
struct cgi {
std::string path;
std::string ext;
};
class Route {
public:
protected:
private:
};
} // namespace config
} // namespace webserv

View File

@ -0,0 +1,16 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* default.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/19 14:15:51 by adjoly #+# #+# */
/* Updated: 2025/03/19 14:16:39 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include <tomlpp.hpp>
#include "Config.hpp"

View File

@ -6,8 +6,10 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */ /* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/03 15:45:07 by mmoussou #+# #+# */ /* Created: 2025/02/03 15:45:07 by mmoussou #+# #+# */
/* Updated: 2025/03/19 14:00:51 by adjoly ### ########.fr */ /* Updated: 2025/03/19 15:52:16 by adjoly ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include <tomlpp.hpp> #include <tomlpp.hpp>
int main(int, char **) { return 0; }