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:
parent
d113932c8f
commit
23246d0d9d
6 changed files with 116 additions and 26 deletions
47
include/configuration.hpp
Normal file
47
include/configuration.hpp
Normal file
|
@ -0,0 +1,47 @@
|
|||
#ifndef GEMINISERVER_CONFIGURATION_HPP
|
||||
#define GEMINISERVER_CONFIGURATION_HPP
|
||||
|
||||
#include "simdjson.h"
|
||||
#include <string>
|
||||
#include <optional>
|
||||
|
||||
|
||||
namespace gemini {
|
||||
struct Information;
|
||||
|
||||
class CacheFiles;
|
||||
|
||||
using namespace std::literals::string_literals;
|
||||
|
||||
/**
|
||||
* \class Configuration
|
||||
* \brief This class is used to configurate the whole server and different classes.
|
||||
*
|
||||
* The configuration is made through a JSON file structured like this :
|
||||
*
|
||||
* {
|
||||
* "content" : folder_to_content,
|
||||
* "cache" : {
|
||||
* "enable_cache" : bool,
|
||||
* "cache_size" : int
|
||||
* },
|
||||
* "ssl" : {
|
||||
* "pem_path" : string,
|
||||
* "cert_path" : string
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
class Configuration {
|
||||
private:
|
||||
const std::string filename{ "config.json"s };
|
||||
|
||||
public:
|
||||
Configuration() = default;
|
||||
|
||||
explicit Configuration(const std::string &filename) : filename(filename) {}
|
||||
|
||||
std::pair<Information, std::optional<CacheFiles>> create_infos() const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //GEMINISERVER_CONFIGURATION_HPP
|
|
@ -6,7 +6,15 @@ namespace gemini {
|
|||
* \brief This struct is used to store information inside, used by any other class/struct.
|
||||
*/
|
||||
struct Information {
|
||||
const bool enable_cache{ false };
|
||||
const std::size_t cache_size{ 0 };
|
||||
const std::string ssl_pem_path{};
|
||||
const std::string ssl_cert_path{};
|
||||
|
||||
Information() = default;
|
||||
|
||||
Information(const bool enableCache, const size_t cacheSize, std::string sslPemPath, std::string sslCertPath) :
|
||||
enable_cache(enableCache), cache_size(cacheSize), ssl_pem_path(std::move(sslPemPath)), ssl_cert_path(std::move(sslCertPath)) {}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue