fix mount
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good

This commit is contained in:
Scott E. Graves 2025-03-03 14:13:14 -06:00
parent ce1a3c416c
commit 43e8db5bb6
6 changed files with 25 additions and 7 deletions

View File

@ -157,6 +157,7 @@ ncrypt
nlohmann
nlohmann_json
nmakeprg
nohup
nominmax
ntstatus
nullptr

View File

@ -53,8 +53,9 @@ ui(std::vector<const char *> args, const std::string & /*data_directory*/,
}
ui::mgmt_app_config config{};
ui::handlers handlers(&config, &server);
config.set_api_port(ui_port);
ui::handlers handlers(&config, &server);
return exit_code::success;
}
} // namespace repertory::cli::actions

View File

@ -61,8 +61,9 @@ private:
void handle_put_set_value_by_name(auto &&req, auto &&res);
auto read_process(provider_type prov, std::string_view name,
std::string_view command) const -> std::vector<std::string>;
auto launch_process(provider_type prov, std::string_view name,
std::string_view command, bool background = false) const
-> std::vector<std::string>;
};
} // namespace repertory::ui

View File

@ -27,9 +27,9 @@
namespace repertory::ui {
class mgmt_app_config final {
private:
std::string api_auth_{"test"};
std::uint16_t api_port_{default_ui_mgmt_port};
std::string api_user_{"test"};
atomic<std::string> api_auth_{"test"};
std::atomic<std::uint16_t> api_port_{default_ui_mgmt_port};
atomic<std::string> api_user_{"test"};
std::unordered_map<provider_type,
std::unordered_map<std::string, std::string>>
locations_;
@ -46,6 +46,8 @@ public:
std::string_view name) const
-> std::string;
void set_api_port(std::uint16_t api_port);
void set_mount_location(provider_type prov, std::string_view name,
std::string_view location);
};

View File

@ -31,6 +31,8 @@
#include "utils/path.hpp"
#include "utils/string.hpp"
#include "boost/process.hpp"
namespace repertory::ui {
handlers::handlers(mgmt_app_config *config, httplib::Server *server)
: config_(config),
@ -320,7 +322,14 @@ auto handlers::launch_process(provider_type prov, std::string_view name,
fmt::format(R"({} {} {})", repertory_binary_, str_type, command);
if (background) {
return "";
#if defined(_WIN32)
system(fmt::format(R"(start "" /b {})", cmd_line).c_str());
#elif defined(__linux__) // defined(__linux__)
system(fmt::format("nohup {} 1>/dev/null 2>&1", cmd_line).c_str());
#else // !defined(__linux__) && !defined(_WIN32)
build fails here
#endif // defined(_WIN32)
return {};
}
auto *pipe = popen(cmd_line.c_str(), "r");

View File

@ -34,6 +34,10 @@ auto mgmt_app_config::get_mount_location(provider_type prov,
return "";
}
void mgmt_app_config::set_api_port(std::uint16_t api_port) {
api_port_ = api_port;
}
void mgmt_app_config::set_mount_location(provider_type prov,
std::string_view name,
std::string_view location) {