Use the config options when creating the default paramstring

This commit is contained in:
Christopher Baines 2020-04-07 17:37:03 +01:00
parent 04bc3af53a
commit 8e9f1af89b

View file

@ -19,6 +19,7 @@
#:use-module (system foreign) #:use-module (system foreign)
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:use-module (squee) #:use-module (squee)
#:use-module (guix-data-service config)
#:export (with-postgresql-connection #:export (with-postgresql-connection
with-postgresql-transaction with-postgresql-transaction
@ -37,7 +38,10 @@
(define paramstring (define paramstring
(string-append (string-append
(or (getenv "GUIX_DATA_SERVICE_DATABASE_PARAMSTRING") (or (getenv "GUIX_DATA_SERVICE_DATABASE_PARAMSTRING")
"dbname=guix_data_service user=guix_data_service") (simple-format
#f "dbname=~A user=~A"
(%config 'database-name)
(%config 'database-user)))
" application_name='guix-data-service " name "'")) " application_name='guix-data-service " name "'"))
(let* ((conn (connect-to-postgres-paramstring (let* ((conn (connect-to-postgres-paramstring