provisioning/schemas/platform/common/database.ncl

47 lines
1.4 KiB
Text

# Database Configuration Schema
# Common schema for database settings (RocksDB, SurrealDB, PostgreSQL)
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
{
DatabaseConfig = {
# Deployment mode: memory (tests), embedded (solo/RocksDB), server (WebSocket)
mode | DbMode | default = "embedded",
# 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,
},
}