Changeset 0.23.1 (#154)

This commit is contained in:
2026-03-06 13:26:25 +00:00
parent 2fc620e1ac
commit 4c6555cb06
38 changed files with 1536 additions and 4031 deletions

View File

@@ -17,6 +17,14 @@ import (
// DB is the application-wide database connection pool.
var DB *sql.DB
// rawDSN holds the Postgres connection string for LISTEN/NOTIFY consumers.
// Empty when running SQLite.
var rawDSN string
// DSN returns the raw Postgres connection string, or "" for SQLite.
// Used by the event broadcast layer to open a dedicated listener connection.
func DSN() string { return rawDSN }
// Connect opens a connection pool to the configured database.
// Driver is selected by DB_DRIVER env var: "postgres" (default) or "sqlite".
// For SQLite the DATABASE_URL is treated as a file path; ":memory:" is supported.
@@ -45,6 +53,7 @@ func connectPostgres(dsn string) error {
// Log the database name for operational clarity (never log credentials).
dbName = extractDBName(dsn)
rawDSN = dsn
log.Printf("Connecting to Postgres database %q ...", dbName)
var err error