WIP
This commit is contained in:
@@ -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
|
||||
|
@@ -9,7 +9,6 @@ namespace dropshell {
|
||||
std::string get_local_dropshell_config_parent_path();
|
||||
std::string get_local_dropshell_config_file();
|
||||
std::string get_local_system_templates_path();
|
||||
|
||||
std::string get_local_backup_path();
|
||||
|
||||
|
||||
@@ -28,22 +27,17 @@ namespace dropshell {
|
||||
// | |-- example
|
||||
// | |-- service.env
|
||||
// | |-- (other service config files)
|
||||
// |-- .remote_versions
|
||||
// | |-- server_name
|
||||
// | |-- service_name.hash.env
|
||||
|
||||
std::string get_primary_local_config_path();
|
||||
|
||||
// system config directories (installed from templates in this git repository)
|
||||
// /opt/dropshell
|
||||
// |-- templates
|
||||
// | |-- template_name
|
||||
// | |-- (script files)
|
||||
// | |-- example
|
||||
// | |-- service.env
|
||||
// | |-- (other service config files)
|
||||
|
||||
int getNumConfigDirectories();
|
||||
std::string get_local_config_path(int index);
|
||||
std::string get_local_config_templates_path(int index);
|
||||
std::string get_local_config_servers_path(int index);
|
||||
std::string get_local_config_backups_path(int index);
|
||||
|
||||
std::string get_local_server_path(const std::string &server_name);
|
||||
std::string get_local_server_env_path(const std::string &server_name);
|
||||
@@ -51,6 +45,8 @@ namespace dropshell {
|
||||
std::string get_local_service_path(const std::string &server_name, const std::string &service_name);
|
||||
std::string get_local_service_env_path(const std::string &server_name, const std::string &service_name);
|
||||
|
||||
std::string get_local_service_hash_path(const std::string &server_name, const std::string &service_name);
|
||||
|
||||
// remote paths
|
||||
// DROPSHELL_DIR
|
||||
// |-- backups
|
||||
|
Reference in New Issue
Block a user