dropshell release 2025.0524.1149
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 17s

This commit is contained in:
Your Name
2025-05-24 11:49:24 +12:00
parent 0934179053
commit 763293c7d0
10 changed files with 64 additions and 60 deletions

View File

@ -19,7 +19,7 @@ namespace localfile {
// Try ~/.config/dropshell/dropshell.json
std::string homedir = localpath::current_user_home();
if (!homedir.empty()) {
fs::path user_path = fs::path(homedir) / ".config" / "dropshell" / "dropshell.json";
fs::path user_path = fs::path(homedir) / ".config" / "dropshell" / filenames::dropshell_json;
return user_path.string();
}
return std::string();
@ -27,18 +27,18 @@ namespace localfile {
std::string server_json(const std::string &server_name) {
std::string serverpath = localpath::server(server_name);
return (serverpath.empty() ? "" : (fs::path(serverpath) / "server.json").string());
return (serverpath.empty() ? "" : (fs::path(serverpath) / filenames::server_json).string());
}
std::string service_env(const std::string &server_name, const std::string &service_name) {
std::string servicepath = localpath::service(server_name, service_name);
return (servicepath.empty() ? "" : (fs::path(servicepath) / "service.env").string());
return (servicepath.empty() ? "" : (fs::path(servicepath) / filenames::service_env).string());
}
std::string template_info_env(const std::string &server_name, const std::string &service_name)
{
std::string servicepath = localpath::service(server_name, service_name);
return (servicepath.empty() ? "" : (fs::path(servicepath) / ".template_info.env").string());
return (servicepath.empty() ? "" : (fs::path(servicepath) / filenames::template_info_env).string());
}
std::string template_example()
@ -165,7 +165,7 @@ namespace localpath {
std::string remotefile::service_env(const std::string &service_name) const
{
return remotepath(mServer_name,mUser).service_config(service_name) + "/service.env";
return remotepath(mServer_name,mUser).service_config(service_name) + "/" + filenames::service_env;
}
@ -218,12 +218,6 @@ namespace localpath {
return (dsp.empty() ? "" : (dsp + "/agent"));
}
// std::string remotepath::service_env(const std::string &service_name) const
// {
// std::string service_path = service_config(service_name);
// return (service_path.empty() ? "" : (service_path + "/service.env"));
// }
// ------------------------------------------------------------------------------------------
// Utility functions

View File

@ -44,7 +44,13 @@ namespace dropshell {
// |-- .template_info.env
// |-- (...other config files for specific server&service...)
namespace filenames {
static const std::string template_info_env = ".template_info.env";
static const std::string service_env = "service.env";
static const std::string readme = "README.txt";
static const std::string server_json = "server.json";
static const std::string dropshell_json = "dropshell.json";
} // namespace filenames.
namespace localfile {
// ~/.config/dropshell/dropshell.json

View File

@ -54,13 +54,12 @@ bool execute_ssh_command(const sSSHInfo & ssh_info, const sCommand & remote_comm
// class to hold a command to run on the remote server.
class sCommand {
public:
sCommand(std::string directory_to_run_in, std::string command_to_run, const std::map<std::string, std::string> & env_vars, bool requires_root = false) :
mDir(directory_to_run_in), mCmd(command_to_run), mVars(env_vars), mRequiresRoot(requires_root) {}
sCommand(std::string directory_to_run_in, std::string command_to_run, const std::map<std::string, std::string> & env_vars) :
mDir(directory_to_run_in), mCmd(command_to_run), mVars(env_vars) {}
std::string get_directory_to_run_in() const { return mDir; }
std::string get_command_to_run() const { return mCmd; }
const std::map<std::string, std::string>& get_env_vars() const { return mVars; }
bool requires_root() const { return mRequiresRoot; }
void add_env_var(const std::string& key, const std::string& value) { mVars[key] = value; }
@ -72,7 +71,6 @@ class sCommand {
std::string makesafecmd(std::string bb64path, const std::string& command) const;
private:
bool mRequiresRoot;
std::string mDir;
std::string mCmd;
std::map<std::string, std::string> mVars;