mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-19 14:51:27 +00:00
48 lines
1.7 KiB
Plaintext
48 lines
1.7 KiB
Plaintext
/// Config holder for all database related things
|
|
/datum/configuration_section/database_configuration
|
|
protection_state = PROTECTION_PRIVATE // NO! BAD!
|
|
/// SQL enabled or not
|
|
var/enabled = FALSE
|
|
/// What SQL version are we on
|
|
var/version = 0
|
|
/// Address of the SQL server
|
|
var/address = "127.0.0.1"
|
|
/// Port of the SQL server
|
|
var/port = 3306
|
|
/// SQL usename
|
|
var/username = "root"
|
|
/// SQL password
|
|
var/password = "root" // Dont do this in prod. Please......
|
|
/// Database name
|
|
var/db = "feedback" // TODO: Rename to paradise_db
|
|
/// Table prefix
|
|
var/table_prefix = "erro_" // TODO: Remove table prefixes
|
|
/// Time in seconds for async queries to time out
|
|
var/async_query_timeout = 10
|
|
/// Thread limit for async queries
|
|
var/async_thread_limit = 50
|
|
|
|
/datum/configuration_section/database_configuration/load_data(list/data)
|
|
// UNIT TESTS ARE DEFINED - USE CUSTOM CI VALUES
|
|
#ifdef UNIT_TESTS
|
|
|
|
enabled = TRUE
|
|
table_prefix = ""
|
|
// This needs to happen in the CI environment to ensure the example SQL version gets updated.
|
|
CONFIG_LOAD_NUM(version, data["sql_version"])
|
|
|
|
#else
|
|
// Load the normal config. Were not in CI mode
|
|
// Use the load wrappers here. That way the default isnt made 'null' if you comment out the config line
|
|
CONFIG_LOAD_BOOL(enabled, data["sql_enabled"])
|
|
CONFIG_LOAD_NUM(version, data["sql_version"])
|
|
CONFIG_LOAD_STR(address, data["sql_address"])
|
|
CONFIG_LOAD_NUM(port, data["sql_port"])
|
|
CONFIG_LOAD_STR(username, data["sql_username"])
|
|
CONFIG_LOAD_STR(password, data["sql_password"])
|
|
CONFIG_LOAD_STR(db, data["sql_database"])
|
|
CONFIG_LOAD_STR(table_prefix, data["sql_table_prefix"])
|
|
CONFIG_LOAD_NUM(async_query_timeout, data["async_query_timeout"])
|
|
CONFIG_LOAD_NUM(async_thread_limit, data["async_thread_limit"])
|
|
#endif
|