From bf4bb6741f1b4d6be203cf06f9ed5becf9b953a9 Mon Sep 17 00:00:00 2001 From: chatlanin Date: Mon, 15 Jul 2024 11:16:42 +0300 Subject: [PATCH] fix move connection --- src/trs/libs/database.hpp | 8 ++++---- src/trs/trs.hpp | 6 ++++-- tests/main.cpp | 5 ++++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/trs/libs/database.hpp b/src/trs/libs/database.hpp index fde2c88..8fd84cd 100644 --- a/src/trs/libs/database.hpp +++ b/src/trs/libs/database.hpp @@ -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 diff --git a/src/trs/trs.hpp b/src/trs/trs.hpp index 0062e23..774bfa9 100644 --- a/src/trs/trs.hpp +++ b/src/trs/trs.hpp @@ -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 diff --git a/tests/main.cpp b/tests/main.cpp index f857c67..c785891 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -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(); }