move app connection

This commit is contained in:
chatlanin 2024-07-15 11:10:29 +03:00
parent 0bdb54556d
commit 52ef60a41b
3 changed files with 9 additions and 5 deletions

View File

@ -27,10 +27,14 @@ namespace trs
std::string DB_LOG_CONNECTION; std::string DB_LOG_CONNECTION;
public: public:
void set_connection(std::string app, std::string log) void set_log_connection(std::string log)
{
DB_LOG_CONNECTION = log;
}
void set_connection(std::string app)
{ {
DB_APP_CONNECTION = app; DB_APP_CONNECTION = app;
DB_LOG_CONNECTION = log;
} }
template<typename... Args> template<typename... Args>

View File

@ -26,7 +26,7 @@ namespace trs
~server() = default; ~server() = default;
public: public:
void init(std::string service_name, std::string app_connection, std::string log_connection) void init(std::string service_name, std::string log_connection)
{ {
set_read_timeout(5, 0); set_read_timeout(5, 0);
set_write_timeout(5, 0); set_write_timeout(5, 0);
@ -34,7 +34,7 @@ namespace trs
set_payload_max_length(1024 * 1024 * 512); // 512MB set_payload_max_length(1024 * 1024 * 512); // 512MB
set_CORS(); set_CORS();
set_post(); set_post();
database::instance().set_connection(app_connection, log_connection); database::instance().set_log_connection(log_connection);
m_service_name = service_name; m_service_name = service_name;
} }

View File

@ -31,7 +31,7 @@ auto main(int argc, char* args[]) -> int
// cli_2.post("func_name",trs::JSON{{ "key", "test message" }}); // cli_2.post("func_name",trs::JSON{{ "key", "test message" }});
trs::server srv; trs::server srv;
srv.init("test service", "app_connection", "log_connection"); srv.init("test service", "log_connection");
srv.registration("healthcheck", worckspaces::inspector, worckspaces::provider); srv.registration("healthcheck", worckspaces::inspector, worckspaces::provider);
srv.run(); srv.run();
} }