22#include "util/config/ConfigFileInterface.hpp"
23#include "util/config/Error.hpp"
24#include "util/config/Types.hpp"
26#include <boost/json/object.hpp>
35namespace util::config {
39 boost::json::object jsonObject_;
57 getValue(std::string_view key)
const override;
65 [[nodiscard]] std::vector<std::optional<Value>>
66 getArray(std::string_view key)
const override;
82 [[nodiscard]] std::vector<std::string>
92 [[nodiscard]]
static std::expected<ConfigFileJson, Error>
101 [[nodiscard]] boost::json::object
const&
114 flattenJson(boost::json::object
const& jsonRootObject);
The interface for configuration files.
Definition ConfigFileInterface.hpp:37
Json representation of config.
Definition ConfigFileJson.hpp:38
static std::expected< ConfigFileJson, Error > makeConfigFileJson(std::filesystem::path const &configFilePath)
Creates a new ConfigFileJson by parsing the provided JSON file and stores the values in the object.
Definition ConfigFileJson.cpp:88
std::vector< std::optional< Value > > getArray(std::string_view key) const override
Retrieves an array of configuration values by its key.
Definition ConfigFileJson.cpp:120
ConfigFileJson(boost::json::object jsonObj)
Construct a new ConfigJson object and stores the values from user's config into a json object.
Definition ConfigFileJson.cpp:82
boost::json::object const & inner() const
Get the inner representation of json file.
Definition ConfigFileJson.cpp:156
Value getValue(std::string_view key) const override
Retrieves a configuration value by its key.
Definition ConfigFileJson.cpp:110
bool containsKey(std::string_view key) const override
Checks if the configuration contains a specific key.
Definition ConfigFileJson.cpp:140
std::vector< std::string > getAllKeys() const override
Retrieves all keys in the configuration file.
Definition ConfigFileJson.cpp:146