This commit is contained in:
John
2025-04-28 18:26:25 +12:00
parent e6a95e39be
commit bd043eaed8
4 changed files with 102 additions and 29 deletions

View File

@ -36,6 +36,14 @@ std::string get_local_system_templates_path()
return "/opt/dropshell/templates";
}
std::string get_local_backup_path()
{
config *cfg = get_global_config();
if (!cfg)
return std::string();
return cfg->get_local_backup_path();
}
int getNumConfigDirectories()
{
config *cfg = get_global_config();
@ -43,6 +51,11 @@ int getNumConfigDirectories()
return local_config_directories.size();
}
std::string get_primary_local_config_path()
{
return get_local_config_path(0);
}
std::string get_local_config_path(int index)
{
config *cfg = get_global_config();
@ -55,16 +68,6 @@ std::string get_local_config_path(int index)
return local_config_directories[index];
}
std::string get_local_backup_path()
{
config *cfg = get_global_config();
if (!cfg)
return std::string();
return cfg->get_local_backup_path();
}
std::string get_local_config_templates_path(int index)
{
std::string config_path = get_local_config_path(index);
@ -81,14 +84,6 @@ std::string get_local_config_servers_path(int index)
return config_path + "/servers";
}
std::string get_local_config_backups_path(int index)
{
std::string config_path = get_local_config_path(index);
if (config_path.empty())
return std::string();
return config_path + "/backups";
}
std::string get_local_server_path(const std::string &server_name)
{
config *cfg = get_global_config();
@ -133,6 +128,18 @@ std::string get_local_service_env_path(const std::string &server_name, const std
return (fs::path(servicepath) / "service.env").string();
}
std::string get_local_service_hash_path(const std::string &server_name, const std::string &service_name)
{
if (server_name.empty() || service_name.empty())
return std::string();
std::string config_path = get_primary_local_config_path();
if (config_path.empty())
return std::string();
return (fs::path(config_path) / ".remote_versions" / server_name / (service_name + ".hash.env")).string();
}
// ------------------------------------------------------------------------------------------
// remote paths