VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
DatabaseConfig.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <string>
4
5
namespace
VoltMod
6
{
7
8
/**
9
* @brief Connection parameters for every supported backend.
10
*
11
* Field names are lowercase so a consumer's JSON config section maps onto them directly:
12
* reflection reads the members, so a plugin needs no mapper - embedding this in a settings
13
* struct is all there is to do.
14
*
15
* The dependency-free header keeps settings structs usable in SDK-free tests and translation
16
* units that do not link a database client.
17
*/
18
struct
DatabaseConfig
19
{
20
/** "postgres", "mariadb" or "sqlite"; anything else fails `Database::Connect`. */
21
std::string
driver
=
"postgres"
;
22
std::string
host
=
"localhost"
;
23
/** 0 uses the driver default (5432 for Postgres, 3306 for MariaDB). Ignored by sqlite. */
24
int
port
= 0;
25
std::string
database
=
"voltmod_server"
;
26
std::string
username
=
"voltmod_plugin"
;
27
std::string
password
;
28
/** Postgres sslmode: disable, allow, prefer, require, verify-ca or verify-full. MariaDB
29
* turns TLS on for require and the verify modes; sqlite ignores it. */
30
std::string
sslMode
=
"prefer"
;
31
/** Bounds every (re)connect attempt so a dead database can't hang queries or unload. */
32
int
connectTimeoutSec
= 5;
33
/** sqlite database file, relative to the game dir. ":memory:" is allowed. */
34
std::string
path
;
35
};
36
37
}
// namespace VoltMod
VoltMod
Definition
Options.hpp:13
VoltMod::DatabaseConfig
Connection parameters for every supported backend.
Definition
DatabaseConfig.hpp:19
VoltMod::DatabaseConfig::driver
std::string driver
Definition
DatabaseConfig.hpp:21
VoltMod::DatabaseConfig::sslMode
std::string sslMode
Definition
DatabaseConfig.hpp:30
VoltMod::DatabaseConfig::database
std::string database
Definition
DatabaseConfig.hpp:25
VoltMod::DatabaseConfig::username
std::string username
Definition
DatabaseConfig.hpp:26
VoltMod::DatabaseConfig::password
std::string password
Definition
DatabaseConfig.hpp:27
VoltMod::DatabaseConfig::host
std::string host
Definition
DatabaseConfig.hpp:22
VoltMod::DatabaseConfig::path
std::string path
Definition
DatabaseConfig.hpp:34
VoltMod::DatabaseConfig::port
int port
Definition
DatabaseConfig.hpp:24
VoltMod::DatabaseConfig::connectTimeoutSec
int connectTimeoutSec
Definition
DatabaseConfig.hpp:32
include
VoltMod
Database
DatabaseConfig.hpp
Generated by
1.9.8