From 897546d596d8d7213cff60146123bb8f97d4d1cc Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 24 Sep 2025 21:28:56 +0100 Subject: Create settings structure Holds all the settings and their defaults for use in program_options and tests. Disables missing-field-initializers in tests because its over sensitive to structures with defaults where you only provide some values specifically. --- src/ingestor.hpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/ingestor.hpp') diff --git a/src/ingestor.hpp b/src/ingestor.hpp index 879526d..719b65b 100644 --- a/src/ingestor.hpp +++ b/src/ingestor.hpp @@ -2,6 +2,7 @@ #include "curlOp.hpp" #include "logTypes.hpp" +#include "settings.hpp" #include #include #include @@ -12,9 +13,17 @@ #include namespace WebStat { + struct IngestorSettings : Settings { + std::string dbConnStr = "dbname=webstat user=webstat"; + std::string userAgentAPI = "https://useragentstring.com"; + unsigned int dbMax = 4; + unsigned int dbKeep = 2; + }; + class Ingestor { public: - Ingestor(const utsname &, DB::ConnectionPoolPtr); + Ingestor(const utsname &, IngestorSettings); + Ingestor(const utsname &, DB::ConnectionPoolPtr, IngestorSettings); virtual ~Ingestor() = default; SPECIAL_MEMBERS_DELETE(Ingestor); @@ -32,7 +41,7 @@ namespace WebStat { template void storeLogLine(DB::Connection *, const std::tuple &) const; - std::string userAgentAPI = "https://useragentstring.com"; + IngestorSettings settings; protected: DB::ConnectionPoolPtr dbpool; -- cgit v1.2.3