VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
VoltMod::DatabaseConfig Struct Reference

Connection parameters for every supported backend. More...

#include <DatabaseConfig.hpp>

Public Attributes

std::string driver = "postgres"
 
std::string host = "localhost"
 
int port = 0
 
std::string database = "voltmod_server"
 
std::string username = "voltmod_plugin"
 
std::string password
 
std::string sslMode = "prefer"
 
int connectTimeoutSec = 5
 
std::string path
 

Detailed Description

Connection parameters for every supported backend.

Field names are lowercase so a consumer's JSON config section maps onto them directly: reflection reads the members, so a plugin needs no mapper - embedding this in a settings struct is all there is to do.

The dependency-free header keeps settings structs usable in SDK-free tests and translation units that do not link a database client.

Definition at line 18 of file DatabaseConfig.hpp.

Member Data Documentation

◆ connectTimeoutSec

int VoltMod::DatabaseConfig::connectTimeoutSec = 5

Bounds every (re)connect attempt so a dead database can't hang queries or unload.

Definition at line 32 of file DatabaseConfig.hpp.

◆ database

std::string VoltMod::DatabaseConfig::database = "voltmod_server"

Definition at line 25 of file DatabaseConfig.hpp.

◆ driver

std::string VoltMod::DatabaseConfig::driver = "postgres"

"postgres", "mariadb" or "sqlite"; anything else fails Database::Connect.

Definition at line 21 of file DatabaseConfig.hpp.

◆ host

std::string VoltMod::DatabaseConfig::host = "localhost"

Definition at line 22 of file DatabaseConfig.hpp.

◆ password

std::string VoltMod::DatabaseConfig::password

Definition at line 27 of file DatabaseConfig.hpp.

◆ path

std::string VoltMod::DatabaseConfig::path

sqlite database file, relative to the game dir. ":memory:" is allowed.

Definition at line 34 of file DatabaseConfig.hpp.

◆ port

int VoltMod::DatabaseConfig::port = 0

0 uses the driver default (5432 for Postgres, 3306 for MariaDB). Ignored by sqlite.

Definition at line 24 of file DatabaseConfig.hpp.

◆ sslMode

std::string VoltMod::DatabaseConfig::sslMode = "prefer"

Postgres sslmode: disable, allow, prefer, require, verify-ca or verify-full. MariaDB turns TLS on for require and the verify modes; sqlite ignores it.

Definition at line 30 of file DatabaseConfig.hpp.

◆ username

std::string VoltMod::DatabaseConfig::username = "voltmod_plugin"

Definition at line 26 of file DatabaseConfig.hpp.


The documentation for this struct was generated from the following file: