gemini-server/include/configuration.hpp

46 lines
970 B
C++

#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:
const std::string filename{ "config.json" };
public:
Configuration() = default;
explicit Configuration(const std::string &filename) : filename(filename) {}
std::pair<Information, std::optional<CacheFiles>> create_infos() const;
};
}
#endif //GEMINISERVER_CONFIGURATION_HPP