From 4cddf5383707d4ae6f7ba8913dd92c6f391dd893 Mon Sep 17 00:00:00 2001 From: niten Date: Tue, 1 Feb 2022 10:06:54 -0800 Subject: [PATCH] Take use_ssl as env var flag --- backplane-dns.lisp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/backplane-dns.lisp b/backplane-dns.lisp index d235576..b29ee97 100644 --- a/backplane-dns.lisp +++ b/backplane-dns.lisp @@ -151,13 +151,15 @@ xmpp-username xmpp-password db-host + db-port db-name db-username - db-password) + db-password + db-use-ssl) (let ((postmodern:*ignore-unknown-columns* t) (cl-postgres:*query-log* *standard-output*) (*dns-store* (make-instance 'backplane-dns-store:postgres-dns-store))) - (postmodern:with-connection (list db-name db-username db-password db-host) + (postmodern:with-connection (list db-name db-username db-password db-host (port db-port) (use-ssl db-use-ssl)) (with-backplane (backplane (backplane-connect xmpp-host xmpp-username xmpp-password)) (start-listening backplane))))) @@ -175,6 +177,10 @@ (uiop:die 1 "unable to find required env var: ~A" env-var)) value))) +(defun getenv-flag (env-var) + (let ((value (uiop:getenv env-var))) + (if value t nil))) + (defun start-listener-with-env () (backplane-dns-listen :xmpp-host (getenv-or-fail "FUDO_DNS_BACKPLANE_XMPP_HOSTNAME") @@ -184,4 +190,6 @@ :db-name (getenv-or-fail "FUDO_DNS_BACKPLANE_DATABASE_NAME") :db-username (getenv-or-fail "FUDO_DNS_BACKPLANE_DATABASE_USERNAME") :db-host (getenv-or-fail "FUDO_DNS_BACKPLANE_DATABASE_HOSTNAME") - :db-password (read-file-line (getenv-or-fail "FUDO_DNS_BACKPLANE_DATABASE_PASSWORD_FILE")))) + :db-port (getenv-or-fail "FUDO_DNS_BACKPLANE_DATABASE_PORT" 5432) + :db-password (read-file-line (getenv-or-fail "FUDO_DNS_BACKPLANE_DATABASE_PASSWORD_FILE")) + :db-use-ssl (getenv-flag "FUDO_DNS_BACKPLANE_DATABASE_USE_SSL")))