Configuration is partially made.

Compilation and linker flags for spdlog are changed to be usable with clang and the project.
Another default logger is made in the main.cpp
Correction in README.md and format.
This commit is contained in:
Pcornat 2021-02-21 11:29:27 +01:00
parent d113932c8f
commit 23246d0d9d
No known key found for this signature in database
GPG key ID: 873C3ACCF970C74E
6 changed files with 116 additions and 26 deletions

15
src/configuration.cpp Normal file
View file

@ -0,0 +1,15 @@
#include "../include/configuration.hpp"
#include "../include/information.hpp"
#include "../include/cache_files.hpp"
std::pair<gemini::Information, std::optional<gemini::CacheFiles>> gemini::Configuration::create_infos() const {
simdjson::dom::parser parser;
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);
}