module

Arcana::DB

Connection management for the Postgres-backed identity / org store.

Configured via ARCANA_DATABASE_URL. Postgres is opt-in โ€” when the env var is unset, Arcana::DB.connection returns nil and callers must handle that. This keeps current single-tenant localhost users working without a database.

Connection format: postgres://user:pass@host:port/dbname

The underlying pool is provided by crystal-db (crystal-pg is the Postgres driver shard). Default pool settings are fine for now; tunables can be added later via env vars if needed.

Class methods

close

Close the pool. Mostly useful for tests and for graceful shutdown.

Source
connection

Open the connection pool. Idempotent โ€” repeated calls return the same DB::Database. Returns nil if ARCANA_DATABASE_URL is unset.

Source
connection!

Force the connection. Raises if ARCANA_DATABASE_URL is unset โ€” use this in code paths that require Postgres (admin CLI, auth middleware), as opposed to opportunistic uses.

Source
enabled?

Has Postgres been configured for this process?

Source

Nested types