From 85b75f77376b5e6cf571bb6ebc34d11c167ca9cf Mon Sep 17 00:00:00 2001 From: fusion32 Date: Thu, 16 Oct 2025 00:47:01 -0300 Subject: make config.cfg a distribution template --- .gitignore | 1 + config.cfg | 43 ------------------------------------------- config.cfg.dist | 42 ++++++++++++++++++++++++++++++++++++++++++ src/database_postgres.cc | 2 +- src/querymanager.hh | 2 +- 5 files changed, 45 insertions(+), 45 deletions(-) delete mode 100644 config.cfg create mode 100644 config.cfg.dist diff --git a/.gitignore b/.gitignore index e32b57d..eb6b658 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,6 @@ build local *.log *.db +config.cfg compile_commands.json diff --git a/config.cfg b/config.cfg deleted file mode 100644 index e2c77d3..0000000 --- a/config.cfg +++ /dev/null @@ -1,43 +0,0 @@ -# HostCache Config -MaxCachedHostNames = 100 -HostNameExpireTime = 30m - -# SQLite Config -#SQLite.File = "tibia.db" -#SQLite.MaxCachedStatements = 100 - -# PostgreSQL Config -# NOTE(fusion): These options are passed directly to `PQconnectdbParams`. -# Empty values are ignored, meaning their defaults will be used instead. -# For more information see: -# https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS -PostgreSQL.Host = "localhost" -PostgreSQL.Port = "5432" -PostgreSQL.DBName = "tibia" -PostgreSQL.User = "tibia" -#PostgreSQL.Password = "" -PostgreSQL.Password = "password" -PostgreSQL.ConnectTimeout = "" -PostgreSQL.ClientEncoding = "UTF8" -PostgreSQL.ApplicationName = "QueryManager" -PostgreSQL.SSLMode = "" -PostgreSQL.SSLRootCert = "" -PostgreSQL.MaxCachedStatements = 100 - -# MySQL/MariaDB Config -#MySQL.Host = "localhost" -#MySQL.Port = "3306" -#MySQL.DBName = "tibia" -#MySQL.User = "tibia" -#MySQL.Password = "" -#MySQL.UnixSocket = "" -#MySQL.MaxCachedStatements = 100 - -# Connection Config -QueryManagerPort = 7173 -QueryManagerPassword = "a6glaf0c" -QueryWorkerThreads = 1 -QueryBufferSize = 1M -QueryMaxAttempts = 3 -MaxConnections = 25 -MaxConnectionIdleTime = 5m diff --git a/config.cfg.dist b/config.cfg.dist new file mode 100644 index 0000000..780c50a --- /dev/null +++ b/config.cfg.dist @@ -0,0 +1,42 @@ +# HostCache Config +MaxCachedHostNames = 100 +HostNameExpireTime = 30m + +# SQLite Config +SQLite.File = "tibia.db" +SQLite.MaxCachedStatements = 100 + +# PostgreSQL Config +# NOTE(fusion): These options are passed directly to `PQconnectdbParams`. +# Empty values are ignored, meaning their defaults will be used instead. +# For more information see: +# https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS +PostgreSQL.Host = "localhost" +PostgreSQL.Port = "5432" +PostgreSQL.DBName = "tibia" +PostgreSQL.User = "tibia" +PostgreSQL.Password = "" +PostgreSQL.ConnectTimeout = "" +PostgreSQL.ClientEncoding = "UTF8" +PostgreSQL.ApplicationName = "QueryManager" +PostgreSQL.SSLMode = "" +PostgreSQL.SSLRootCert = "" +PostgreSQL.MaxCachedStatements = 100 + +# MySQL/MariaDB Config +MySQL.Host = "localhost" +MySQL.Port = "3306" +MySQL.DBName = "tibia" +MySQL.User = "tibia" +MySQL.Password = "" +MySQL.UnixSocket = "" +MySQL.MaxCachedStatements = 100 + +# Connection Config +QueryManagerPort = 7173 +QueryManagerPassword = "a6glaf0c" +QueryWorkerThreads = 1 +QueryBufferSize = 1M +QueryMaxAttempts = 3 +MaxConnections = 25 +MaxConnectionIdleTime = 5m diff --git a/src/database_postgres.cc b/src/database_postgres.cc index 8cfc6ab..3c522c1 100644 --- a/src/database_postgres.cc +++ b/src/database_postgres.cc @@ -145,7 +145,7 @@ static void ParamBool(ParamBuffer *Params, bool Value){ if(Params->PreferredFormat == 1){ // BINARY FORMAT uint8 Data = (Value ? 0x01 : 0x00); InsertBinaryParam(Params, &Data, 1); - }else{ // TEXT FORMAT + }else{ InsertTextParam(Params, (Value ? "TRUE" : "FALSE")); } } diff --git a/src/querymanager.hh b/src/querymanager.hh index a7108a6..46ea80d 100644 --- a/src/querymanager.hh +++ b/src/querymanager.hh @@ -642,7 +642,7 @@ public: // String Buffer //============================================================================== -template +template struct StringBuffer{ private: STATIC_ASSERT(N > 0); -- cgit v1.2.3