1 | #pragma once |
2 | |
3 | #include "unit/unit.hpp" |
4 | |
5 | #include <filesystem> |
6 | #include <map> |
7 | #include <memory> |
8 | #include <string> |
9 | #include <toml++/toml.hpp> |
10 | |
11 | struct GlobalConfig |
12 | { |
13 | std::string default_target; |
14 | |
15 | void parse(toml::table &data) |
16 | { |
17 | this->default_target = data["default_target" ].value_or(default_value: "default.target" ); |
18 | data.erase(key: "default_target" ); |
19 | } |
20 | }; |
21 | |
22 | extern GlobalConfig global_config; |
23 | extern bool debug; |
24 | extern std::map<std::string, pid_t> service_pid; |
25 | extern std::map<std::string, std::shared_ptr<Unit>> units; |
26 | |
27 | void load_configurations(const std::filesystem::path &config_path); |
28 | |