2021-02-21 11:29:27 +01:00
|
|
|
#ifndef GEMINISERVER_CONFIGURATION_HPP
|
|
|
|
#define GEMINISERVER_CONFIGURATION_HPP
|
|
|
|
|
|
|
|
#include "simdjson.h"
|
|
|
|
#include <string>
|
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
|
|
|
|
namespace gemini {
|
|
|
|
struct Information;
|
|
|
|
|
|
|
|
class CacheFiles;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \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:
|
2021-02-21 11:33:46 +01:00
|
|
|
const std::string filename{ "config.json" };
|
2021-02-21 11:29:27 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
Configuration() = default;
|
|
|
|
|
|
|
|
explicit Configuration(const std::string &filename) : filename(filename) {}
|
|
|
|
|
|
|
|
std::pair<Information, std::optional<CacheFiles>> create_infos() const;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //GEMINISERVER_CONFIGURATION_HPP
|