Fix list a bit
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled

This commit is contained in:
Your Name
2025-05-23 23:07:26 +12:00
parent b07704612b
commit e1c631dc72
11 changed files with 174 additions and 136 deletions

View File

@@ -65,7 +65,7 @@ namespace dropshell
}
// Verify required variables exist
for (const auto &var : {"SSH_HOST", "SSH_PORT", "USERS"})
for (const auto &var : {"SSH_HOST", "SSH_PORT", "SSH_USERS"})
{
if (mVariables.find(var) == mVariables.end())
{
@@ -80,13 +80,13 @@ namespace dropshell
}
// Parse users array
if (!server_env_json.contains("USERS") || !server_env_json["USERS"].is_array())
if (!server_env_json.contains("SSH_USERS") || !server_env_json["SSH_USERS"].is_array())
{
error << "USERS array not found or invalid in server configuration" << std::endl;
error << "SSH_USERS array not found or invalid in server configuration" << std::endl;
return;
}
for (const auto &user_json : server_env_json["USERS"])
for (const auto &user_json : server_env_json["SSH_USERS"])
{
UserConfig user;
user.user = user_json["USER"].get<std::string>();
@@ -96,7 +96,7 @@ namespace dropshell
if (mUsers.empty())
{
error << "No users defined in server configuration" << std::endl;
error << "No users defined in server configuration " << server_env_path << std::endl;
return;
}
@@ -181,7 +181,7 @@ namespace dropshell
[&user](const UserConfig &u)
{ return u.user == user; });
ASSERT(it != mUsers.end(), ("User " + user + " not found in server environment."));
return sSSHInfo{get_SSH_HOST(), user, get_SSH_PORT(), get_server_name()};
return sSSHInfo(get_SSH_HOST(), it->user, get_SSH_PORT(), get_server_name(), it->dir);
}
bool server_config::check_remote_dir_exists(const std::string &dir_path, std::string user) const
@@ -449,4 +449,15 @@ namespace dropshell
}
}
bool server_exists(const std::string &server_name)
{
std::string server_existing_dir = localpath::server(server_name);
if (server_existing_dir.empty())
return false;
if (std::filesystem::exists(server_existing_dir));
return true;
return false;
}
} // namespace dropshell