This commit is contained in:
Your Name
2025-05-23 21:41:33 +12:00
parent 94f77994f0
commit 048345c636
21 changed files with 377 additions and 203 deletions

View File

@@ -19,7 +19,8 @@ namespace dropshell {
return !service_info.service_name.empty() &&
!service_info.template_name.empty() &&
!service_info.local_service_path.empty() &&
!service_info.local_template_path.empty();
!service_info.local_template_path.empty() &&
!service_info.user.empty();
}
std::vector<LocalServiceInfo> get_server_services_info(const std::string& server_name) {
@@ -169,14 +170,17 @@ bool get_all_service_env_vars(const std::string &server_name, const std::string
if (server_info.ssh_host.empty())
std::cerr << "Error: Server " << server_name << " not found - ssh_host empty, so HOST_NAME not set" << std::endl;
std::string user = server_env_manager::get_user_for_service(server_name, service_name);
// add in some handy variables.
// if we change these, we also need to update agent/_allservicesstatus.sh
all_env_vars["CONFIG_PATH"] = remotepath::service_config(server_name,service_name);
all_env_vars["CONFIG_PATH"] = remotepath(server_name,user).service_config(service_name);
all_env_vars["SERVER"] = server_name;
all_env_vars["SERVICE"] = service_name;
all_env_vars["AGENT_PATH"] = remotepath::agent(server_name);
all_env_vars["AGENT_PATH"] = remotepath(server_name,user).agent();
all_env_vars["HOST_NAME"] = server_info.ssh_host;
all_env_vars["DOCKER_CLI_HINTS"] = "false"; // turn off docker junk.
all_env_vars["SSH_USER"] = user;
// Lambda function to load environment variables from a file
auto load_env_file = [&all_env_vars](const std::string& file) {