mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-08 07:16:58 +02:00
Add support for PGSSLMODE environment variable.
PostgreSQL supports many environment variable to drive its connection behavior, as documented at the following reference: https://www.postgresql.org/docs/current/static/libpq-envars.html We don't yet support everything, adding them one piece at a time.
This commit is contained in:
parent
7b4821e26c
commit
047cf84341
@ -106,6 +106,12 @@
|
|||||||
(declare (ignore key e))
|
(declare (ignore key e))
|
||||||
(cons :use-ssl val))))
|
(cons :use-ssl val))))
|
||||||
|
|
||||||
|
(defun get-pgsslmode (&optional (env-var-name "PGSSLMODE") default)
|
||||||
|
"Get PGSSLMODE from the environment."
|
||||||
|
(let ((pgsslmode (getenv-default env-var-name default)))
|
||||||
|
(when pgsslmode
|
||||||
|
(cdr (parse 'dsn-option-ssl (format nil "sslmode=~a" pgsslmode))))))
|
||||||
|
|
||||||
(defrule qualified-table-name (and maybe-quoted-namestring
|
(defrule qualified-table-name (and maybe-quoted-namestring
|
||||||
"."
|
"."
|
||||||
maybe-quoted-namestring)
|
maybe-quoted-namestring)
|
||||||
@ -210,7 +216,7 @@
|
|||||||
(getenv-default "PGPORT" "5432")))
|
(getenv-default "PGPORT" "5432")))
|
||||||
:name (or dbname (getenv-default "PGDATABASE" user))
|
:name (or dbname (getenv-default "PGDATABASE" user))
|
||||||
|
|
||||||
:use-ssl use-ssl
|
:use-ssl (or use-ssl (get-pgsslmode "PGSSLMODE"))
|
||||||
:table-name table-name)))
|
:table-name table-name)))
|
||||||
;; Now set the password, maybe from ~/.pgpass
|
;; Now set the password, maybe from ~/.pgpass
|
||||||
(setf (db-pass pgconn)
|
(setf (db-pass pgconn)
|
||||||
|
Loading…
Reference in New Issue
Block a user