improve config: separate :connect-args

This commit is contained in:
Helmut Merz 2024-05-09 10:45:23 +02:00
parent 3f2fea6617
commit 3aacee896d
2 changed files with 13 additions and 10 deletions

View file

@ -46,11 +46,11 @@
(defun connect-sqlite (params config)
(declare (ignorable params))
(print config)
(apply #'dbi:connect-cached (cons :sqlite3 config)))
(apply #'dbi:connect-cached (cons :sqlite3 (getf config :connect-args))))
(defun connect-postgres (params config)
(declare (ignorable params))
(apply #'dbi:connect (cons :postgres config)))
(apply #'dbi:connect (cons :postgres (getf config :connect-args))))
(defvar *db-params*
'(:sqlite3 (:connect connect-sqlite

View file

@ -3,17 +3,20 @@
(defparameter db-config-sqlite
'(:db-type :sqlite3
:database-name "test/test.db"
:busy-timeout 1))
:connect-args
(:database-name "test/test.db")
:options nil))
(defparameter db-config-postgres
'(:db-type :postgres
:database-name "cltest"
:connect-args
(:database-name "cltest"
:host "localhost"
:port 5432
:username "testuser"
:password "secret"
:schema "testing"))
:password "secret")
:options
(:schema "testing")))
(setf scopes/test-storage:*db-config-sqlite* db-config-sqlite)
(setf scopes/test-storage:*db-config-postgres* db-config-postgres)