2026-01-08 09:55:37 +00:00
|
|
|
# Database Configuration Schema
|
|
|
|
|
# Common schema for database settings (RocksDB, SurrealDB, PostgreSQL)
|
|
|
|
|
|
2026-05-12 02:23:01 +01:00
|
|
|
let DbMode = std.contract.custom
|
|
|
|
|
(fun label value =>
|
|
|
|
|
if value == "memory" || value == "embedded" || value == "server" then 'Ok value
|
|
|
|
|
else std.contract.blame_with_message "database.mode must be 'memory', 'embedded', or 'server'" label)
|
|
|
|
|
in
|
|
|
|
|
|
2026-01-08 09:55:37 +00:00
|
|
|
{
|
|
|
|
|
DatabaseConfig = {
|
2026-05-12 02:23:01 +01:00
|
|
|
# Deployment mode: memory (tests), embedded (solo/RocksDB), server (WebSocket)
|
|
|
|
|
mode | DbMode | default = "embedded",
|
2026-01-08 09:55:37 +00:00
|
|
|
# Database backend selection (filesystem, rocksdb, surrealdb_embedded, surrealdb_server, postgres)
|
|
|
|
|
backend | String,
|
|
|
|
|
|
|
|
|
|
# Local storage path (for filesystem and rocksdb)
|
|
|
|
|
path | String | optional,
|
|
|
|
|
|
|
|
|
|
# Connection string for remote databases (SurrealDB server, PostgreSQL)
|
|
|
|
|
connection_string | String | optional,
|
|
|
|
|
|
|
|
|
|
# Database name/namespace
|
|
|
|
|
database | String | optional,
|
|
|
|
|
|
|
|
|
|
# Namespace for multi-tenant databases
|
|
|
|
|
namespace | String | optional,
|
|
|
|
|
|
|
|
|
|
# Connection pool settings
|
|
|
|
|
pool_size | Number | optional,
|
|
|
|
|
|
|
|
|
|
# Connection timeout in milliseconds
|
|
|
|
|
timeout | Number | optional,
|
|
|
|
|
|
|
|
|
|
# Enable connection retry
|
|
|
|
|
retry | Bool | default = true,
|
|
|
|
|
|
|
|
|
|
# Max retry attempts
|
|
|
|
|
max_retries | String | optional,
|
|
|
|
|
|
|
|
|
|
# Credentials for authenticated databases
|
|
|
|
|
credentials | {
|
|
|
|
|
username | String | optional,
|
|
|
|
|
password | String | optional,
|
|
|
|
|
} | optional,
|
|
|
|
|
},
|
|
|
|
|
}
|