This commit is contained in:
@@ -120,14 +120,14 @@ bool config::is_agent_installed()
|
||||
return std::filesystem::exists(localfile::bb64());
|
||||
}
|
||||
|
||||
std::vector<std::string> config::get_template_registry_urls() {
|
||||
nlohmann::json template_registry_urls = mConfig["template_registry_URLs"];
|
||||
std::vector<std::string> urls;
|
||||
for (auto &url : template_registry_urls) {
|
||||
if (url.is_string() && !url.empty())
|
||||
urls.push_back(url);
|
||||
std::vector<tRegistryEntry> config::get_template_registry_urls() {
|
||||
nlohmann::json template_registries = mConfig["template_registries"];
|
||||
std::vector<tRegistryEntry> registries;
|
||||
for (auto ®istry : template_registries) {
|
||||
if (registry.is_object() && !registry.empty())
|
||||
registries.push_back(tRegistryEntry(registry));
|
||||
}
|
||||
return urls;
|
||||
return registries;
|
||||
}
|
||||
|
||||
std::vector<std::string> config::get_local_template_paths()
|
||||
@@ -167,22 +167,31 @@ std::string config::get_template_create_path()
|
||||
return paths[0];
|
||||
}
|
||||
|
||||
std::string config::get_template_upload_url()
|
||||
{
|
||||
std::vector<std::string> urls = get_template_registry_urls();
|
||||
if (urls.empty())
|
||||
return "";
|
||||
return urls[0];
|
||||
}
|
||||
|
||||
std::string config::get_template_upload_token() {
|
||||
return mConfig["template_upload_token"];
|
||||
}
|
||||
|
||||
std::string config::get_backups_path()
|
||||
{
|
||||
return mConfig["backups_path"];
|
||||
}
|
||||
|
||||
dropshell::tRegistryEntry::tRegistryEntry(nlohmann::json json)
|
||||
{
|
||||
if (json.is_object() && !json.empty()) {
|
||||
for (auto &[key, value] : json.items()) {
|
||||
if (tolower(key) == "name") {
|
||||
name = value;
|
||||
} else if (tolower(key) == "url") {
|
||||
url = value;
|
||||
} else if (tolower(key) == "token") {
|
||||
token = value;
|
||||
}
|
||||
}
|
||||
valid = true;
|
||||
} else {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
tRegistryEntry::~tRegistryEntry()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace dropshell
|
Reference in New Issue
Block a user