18 lines
767 B
C++
18 lines
767 B
C++
#include "../include/configuration.hpp"
|
|
#include "../include/information.hpp"
|
|
#include "../include/cache_files.hpp"
|
|
#include <spdlog/spdlog.h>
|
|
|
|
std::pair<gemini::Information, std::optional<gemini::CacheFiles>> gemini::Configuration::create_infos() const {
|
|
simdjson::dom::parser parser;
|
|
spdlog::debug("Creating infos and cache if enabled");
|
|
const auto config = parser.load(filename);
|
|
const Information infos{
|
|
config["cache"]["enable_cache"].get_bool(),
|
|
config["cache"]["cache_size"].get_uint64(),
|
|
config["ssl"]["pem_path"].get_c_str().value(),
|
|
config["ssl"]["cert_path"].get_c_str().value() };
|
|
return std::make_pair(infos,
|
|
infos.enable_cache ? std::optional(CacheFiles(config["content"]["path"].get_c_str().value(), infos)) : std::nullopt);
|
|
}
|