fix move connection

This commit is contained in:
chatlanin 2024-07-15 11:16:42 +03:00
parent 52ef60a41b
commit bf4bb6741f
3 changed files with 12 additions and 7 deletions

View File

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

View File

@ -26,7 +26,7 @@ namespace trs
~server() = default;
public:
void init(std::string service_name, std::string log_connection)
void init(std::string service_name)
{
set_read_timeout(5, 0);
set_write_timeout(5, 0);
@ -34,10 +34,12 @@ namespace trs
set_payload_max_length(1024 * 1024 * 512); // 512MB
set_CORS();
set_post();
database::instance().set_log_connection(log_connection);
m_service_name = service_name;
}
void set_log_connection(std::string connection) { database::instance().set_log_connection(connection); }
void set_app_connection(std::string connection) { database::instance().set_app_connection(connection); }
void log_to_console(bool v) { m_log_to_console = v; }
template<typename Function>

View File

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