#include #include #include #include #include #include "include/configuration.hpp" #include "include/cache_files.hpp" #include "include/network.hpp" namespace po = boost::program_options; int main(int argc, char *argv[]) { // Create logger auto logger = spdlog::stdout_color_st("single_log"); spdlog::set_default_logger(logger); // If the user si root, stop the program if (getuid() == 0) { spdlog::error("The user is root. Stopping the program."); return EXIT_FAILURE; } po::options_description description{ "Allowed options" }; description.add_options()("help", "produce help message")("config", po::value(), "path to the config file"); po::variables_map vm; po::store(po::parse_command_line(argc, argv, description), vm); po::notify(vm); if (vm.count("help")) { std::cout << description << '\n'; return EXIT_SUCCESS; } const auto[infos, caches] = [&]() -> gemini::Configuration { if (vm.count("config")) { spdlog::debug("config file was set to {}", vm["config"].as()); return gemini::Configuration{ vm["config"].as() }; } return gemini::Configuration{}; }().create_infos(); boost::asio::io_context io_context; gemini::Network network(io_context, infos); return EXIT_SUCCESS; }