Refactor now mostly working

This commit is contained in:
Your Name
2025-04-23 22:43:16 +12:00
parent dbbb0af459
commit 94f2236a7c
5 changed files with 34 additions and 6 deletions

View File

@ -21,11 +21,15 @@ namespace dropshell {
service_runner::service_runner() : m_server_name(""), m_server_env(nullptr) {}
bool service_runner::init(const std::string& server_name, const std::string& service_name) {
if (server_name.empty() || service_name.empty())
return false;
// Initialize server environment
try {
m_server_env = std::make_unique<server_env>(server_name);
if (!m_server_env->is_valid()) {
std::cerr << "Error: Invalid server environment" << std::endl;
m_server_env.reset();
return false;
}
} catch (const std::exception& e) {
@ -33,14 +37,14 @@ bool service_runner::init(const std::string& server_name, const std::string& ser
return false;
}
m_server_name = server_name;
m_service_info = get_service_info(server_name, service_name);
mRemote_service_path = get_remote_service_path(m_server_name, m_service_info.service_name);
mRemote_service_config_path = get_remote_service_config_path(m_server_name, m_service_info.service_name);
mRemote_service_template_path = get_remote_service_template_path(m_server_name, m_service_info.service_name);
mRemote_service_env_file = get_remote_service_env_file(m_server_name, m_service_info.service_name);
m_server_name = server_name;
m_service_info = get_service_info(server_name, service_name);
return !m_service_info.path.empty();
}