Take use_ssl as env var flag

This commit is contained in:
niten 2022-02-01 10:06:54 -08:00
parent 3075453a8c
commit 4cddf53837
1 changed files with 11 additions and 3 deletions

View File

@ -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")))