/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ServerConfig.hpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: me +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/07/23 15:55:16 by me #+# #+# */ /* Updated: 2022/07/23 16:19:43 by me ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef SERVERCONFIG_HPP # define SERVERCONFIG_HPP // add includes properly... # include "Webserv.hpp" # include "MethodType.hpp" //# include "ConfigParser.hpp" # include "LocationConfig.hpp" // a class that's all public? just so we have options? class ServerConfig { public: // i mean i guess i need some canonic stuff? // although maybe if i make it a struct i can barebones it? std::string server_name; std::string root; std::vector index; std::map error_pages; // i'm tempted to do something diff for storing method types... std::vector allow_methods; std::vector locations; // might do something diff struct timeval send_timeout; struct timeval recv_timeout; int client_body_limit; bool autoindex; // not sure what these look like in config file int redirect_status; std::string redirect_uri; // is this the best way? std::string host; std::string port; // do i need a print all for testing? void print_all() { std::cout << "PRINTING A FULL SERVER CONFIG\n\n"; std::cout << "Server_name: " << server_name << '\n'; std::cout << "root: " << root << '\n'; std::cout << "index: "; for (size_t i = 0; i < index.size(); i++) std::cout << index[i] << " "; std::cout << "\nerror_pages: "; for(std::map::iterator it = error_pages.begin(); \ it != error_pages.end(); it++) std::cout << it->first << "--" << it->second << " "; // for (size_t i = 0; i < error_pages.size(); i++) // std::cout << error_pages->first << "--" << error_pages->second << " "; std::cout << "\nallow_methods: "; for (size_t i = 0; i < allow_methods.size(); i++) std::cout << allow_methods[i] << " "; std::cout << "\nskiping Locations for now...\n"; std::cout << "also skiping send_timeout and recv\n"; std::cout << "autoindex: " << autoindex << '\n'; std::cout << "client_body_limit: " << client_body_limit << '\n'; std::cout << "redirect_status: " << redirect_status << '\n'; std::cout << "redirect_uri: " << redirect_uri << '\n'; std::cout << "host: " << host << '\n'; std::cout << "port: " << port << '\n'; std::cout << "\n----------\n"; } }; #endif