diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-09-24 21:28:56 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-09-24 21:33:13 +0100 |
commit | 897546d596d8d7213cff60146123bb8f97d4d1cc (patch) | |
tree | aa3ec6a8db09d6eaf915805986e57d691c7d11f6 /src/ingestor.hpp | |
parent | 71803b97f1c9e31f2027da48bb742353f9c43e62 (diff) | |
download | webstat-897546d596d8d7213cff60146123bb8f97d4d1cc.tar.bz2 webstat-897546d596d8d7213cff60146123bb8f97d4d1cc.tar.xz webstat-897546d596d8d7213cff60146123bb8f97d4d1cc.zip |
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.
Diffstat (limited to 'src/ingestor.hpp')
-rw-r--r-- | src/ingestor.hpp | 13 |
1 files changed, 11 insertions, 2 deletions
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 <c++11Helpers.h> #include <connectionPool.h> #include <connection_fwd.h> @@ -12,9 +13,17 @@ #include <sys/utsname.h> 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<typename... T> void storeLogLine(DB::Connection *, const std::tuple<T...> &) const; - std::string userAgentAPI = "https://useragentstring.com"; + IngestorSettings settings; protected: DB::ConnectionPoolPtr dbpool; |