Config service may not be here (unit tests)

This commit is contained in:
emeric
2023-11-17 08:44:41 +01:00
parent 60bb6170e2
commit 0cc73ca022
+2 -2
View File
@@ -89,8 +89,8 @@ namespace Database
LMS_LOG(DB, INFO) << "Creating connection pool on file " << dbPath.string();
auto connection{ std::make_unique<Connection>(dbPath.string()) };
if (Service<IConfig>::get()->getBool("db-show-queries", false))
connection->setProperty("show-queries", "true");
if (IConfig * config{ Service<IConfig>::get() })// may not be here on testU
connection->setProperty("show-queries", config->getBool("db-show-queries", false) ? "true" : "false");
auto connectionPool{ std::make_unique<Wt::Dbo::FixedSqlConnectionPool>(std::move(connection), connectionCount) };
connectionPool->setTimeout(std::chrono::seconds{ 10 });