jay/component/config.h

48 lines
1.1 KiB
C++

// SPDX-FileCopyrightText: 2024 Yury Gubich <blue@macaw.me>
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <string>
#include <map>
#include <fstream>
#include <filesystem>
#include "gloox/gloox.h"
#include "yaml-cpp/yaml.h"
#include "shared/definitions.h"
#include "shared/result.h"
#include "shared/logger.h"
class Config {
public:
struct Module {
bool enabled;
std::string alias;
Shared::Permissions permissions;
};
public:
Config(const std::filesystem::path& path);
bool isValid() const;
std::string getBareJID() const;
std::string getFullJID() const;
std::string getPassword() const;
std::string getResource() const;
std::map<std::string, std::string> getActors() const;
Shared::Logger::Level getLogLevel() const;
gloox::TLSPolicy getTLSPolicy() const;
Module getModuleConfig(const std::string& name) const;
Shared::Responses getResponses() const;
void setActors(const std::map<std::string, std::string>& actors);
private:
std::filesystem::path path;
YAML::Node root;
};