Changeset 0.23.1 (#154)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user