refactor(main): clean up
This commit is contained in:
parent
72e3f962e4
commit
a8b71747bb
@ -3,32 +3,24 @@
|
||||
#include <webserv/server/Server.hpp> // for Server
|
||||
|
||||
#include <iostream> // for basic_ostream, operator<<, cerr, ios_base
|
||||
#include <map> // for map
|
||||
#include <string> // for basic_string, char_traits, allocator, operator+, operator<=>
|
||||
#include <utility> // for pair
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
std::cerr << "Usage: " << argv[0] << " <config_file_path>\n"; // NOLINT
|
||||
Log::error("Usage: " + std::string(argv[0]) + " <config_file_path>"); // NOLINT
|
||||
return 1;
|
||||
}
|
||||
|
||||
Log::setFileChannel("webserv.log", std::ios_base::trunc, Log::Level::Info);
|
||||
Log::setStdoutChannel(Log::Level::Trace);
|
||||
Log::setStdoutChannel(Log::Level::Info);
|
||||
|
||||
Log::info("\n======================\nStarting webserv...\n======================\n");
|
||||
ConfigManager::getInstance().init(argv[1]); // NOLINT
|
||||
ConfigManager &configManager = ConfigManager::getInstance();
|
||||
Log::info("ConfigManager initialized successfully.");
|
||||
|
||||
// auto serverConfigs = configManager.getServerConfigs();
|
||||
// auto *firstServer = serverConfigs[0];
|
||||
// const auto *location = firstServer->getLocation("/");
|
||||
// const auto *listenDirective = location->getDirective("listen");
|
||||
// int listenPort = listenDirective->getValueAs<int>();
|
||||
// Log::warning("Listen port for '/' location: " + std::to_string(listenPort));
|
||||
|
||||
Log::debug("ConfigManager initialized successfully.");
|
||||
Server server(configManager);
|
||||
|
||||
server.start();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user