This commit is contained in:
parent
ce1a3c416c
commit
43e8db5bb6
@ -157,6 +157,7 @@ ncrypt
|
|||||||
nlohmann
|
nlohmann
|
||||||
nlohmann_json
|
nlohmann_json
|
||||||
nmakeprg
|
nmakeprg
|
||||||
|
nohup
|
||||||
nominmax
|
nominmax
|
||||||
ntstatus
|
ntstatus
|
||||||
nullptr
|
nullptr
|
||||||
|
@ -53,8 +53,9 @@ ui(std::vector<const char *> args, const std::string & /*data_directory*/,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui::mgmt_app_config config{};
|
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;
|
return exit_code::success;
|
||||||
}
|
}
|
||||||
} // namespace repertory::cli::actions
|
} // namespace repertory::cli::actions
|
||||||
|
@ -61,8 +61,9 @@ private:
|
|||||||
|
|
||||||
void handle_put_set_value_by_name(auto &&req, auto &&res);
|
void handle_put_set_value_by_name(auto &&req, auto &&res);
|
||||||
|
|
||||||
auto read_process(provider_type prov, std::string_view name,
|
auto launch_process(provider_type prov, std::string_view name,
|
||||||
std::string_view command) const -> std::vector<std::string>;
|
std::string_view command, bool background = false) const
|
||||||
|
-> std::vector<std::string>;
|
||||||
};
|
};
|
||||||
} // namespace repertory::ui
|
} // namespace repertory::ui
|
||||||
|
|
||||||
|
@ -27,9 +27,9 @@
|
|||||||
namespace repertory::ui {
|
namespace repertory::ui {
|
||||||
class mgmt_app_config final {
|
class mgmt_app_config final {
|
||||||
private:
|
private:
|
||||||
std::string api_auth_{"test"};
|
atomic<std::string> api_auth_{"test"};
|
||||||
std::uint16_t api_port_{default_ui_mgmt_port};
|
std::atomic<std::uint16_t> api_port_{default_ui_mgmt_port};
|
||||||
std::string api_user_{"test"};
|
atomic<std::string> api_user_{"test"};
|
||||||
std::unordered_map<provider_type,
|
std::unordered_map<provider_type,
|
||||||
std::unordered_map<std::string, std::string>>
|
std::unordered_map<std::string, std::string>>
|
||||||
locations_;
|
locations_;
|
||||||
@ -46,6 +46,8 @@ public:
|
|||||||
std::string_view name) const
|
std::string_view name) const
|
||||||
-> std::string;
|
-> std::string;
|
||||||
|
|
||||||
|
void set_api_port(std::uint16_t api_port);
|
||||||
|
|
||||||
void set_mount_location(provider_type prov, std::string_view name,
|
void set_mount_location(provider_type prov, std::string_view name,
|
||||||
std::string_view location);
|
std::string_view location);
|
||||||
};
|
};
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
#include "utils/path.hpp"
|
#include "utils/path.hpp"
|
||||||
#include "utils/string.hpp"
|
#include "utils/string.hpp"
|
||||||
|
|
||||||
|
#include "boost/process.hpp"
|
||||||
|
|
||||||
namespace repertory::ui {
|
namespace repertory::ui {
|
||||||
handlers::handlers(mgmt_app_config *config, httplib::Server *server)
|
handlers::handlers(mgmt_app_config *config, httplib::Server *server)
|
||||||
: config_(config),
|
: 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);
|
fmt::format(R"({} {} {})", repertory_binary_, str_type, command);
|
||||||
|
|
||||||
if (background) {
|
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");
|
auto *pipe = popen(cmd_line.c_str(), "r");
|
||||||
|
@ -34,6 +34,10 @@ auto mgmt_app_config::get_mount_location(provider_type prov,
|
|||||||
return "";
|
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,
|
void mgmt_app_config::set_mount_location(provider_type prov,
|
||||||
std::string_view name,
|
std::string_view name,
|
||||||
std::string_view location) {
|
std::string_view location) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user