From 52ef60a41b624a020a3ae818f15cf5c8fe061c9d Mon Sep 17 00:00:00 2001 From: chatlanin Date: Mon, 15 Jul 2024 11:10:29 +0300 Subject: [PATCH] move app connection --- src/trs/libs/database.hpp | 8 ++++++-- src/trs/trs.hpp | 4 ++-- tests/main.cpp | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/trs/libs/database.hpp b/src/trs/libs/database.hpp index 009f0d6..fde2c88 100644 --- a/src/trs/libs/database.hpp +++ b/src/trs/libs/database.hpp @@ -27,10 +27,14 @@ namespace trs std::string DB_LOG_CONNECTION; 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_LOG_CONNECTION = log; } template diff --git a/src/trs/trs.hpp b/src/trs/trs.hpp index da6580f..0062e23 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 app_connection, std::string log_connection) + void init(std::string service_name, std::string log_connection) { set_read_timeout(5, 0); set_write_timeout(5, 0); @@ -34,7 +34,7 @@ namespace trs set_payload_max_length(1024 * 1024 * 512); // 512MB set_CORS(); set_post(); - database::instance().set_connection(app_connection, log_connection); + database::instance().set_log_connection(log_connection); m_service_name = service_name; } diff --git a/tests/main.cpp b/tests/main.cpp index f01d601..f857c67 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -31,7 +31,7 @@ auto main(int argc, char* args[]) -> int // cli_2.post("func_name",trs::JSON{{ "key", "test message" }}); 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.run(); }