Added back hostname-rx (still used) and renamed listen functions.

This commit is contained in:
Niten 2020-11-11 10:52:09 -08:00
parent 9ba9ed308f
commit 56627e7b39
2 changed files with 13 additions and 10 deletions

View File

@ -1,4 +1,4 @@
;;;; dns-backplane.asd
;;;; backplane-dns.asd
(asdf:defsystem #:backplane-dns
:description "Server to listen on Fudo backplane for DNS updates"

View File

@ -77,6 +77,9 @@
(defun make-error (&optional msg)
(make-instance 'result/error :message msg))
(defparameter *hostname-rx*
"([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])")
(defun get-domain (name)
(car (select-dao 'dns-domain (:= 'name name))))
@ -181,13 +184,13 @@
:mechanism :sasl-plain)
(funcall f backplane)))
(defun backplane-dns-listen (xmpp-host
xmpp-username
xmpp-password
db-host
db-name
db-username
db-password)
(defun listen (xmpp-host
xmpp-username
xmpp-password
db-host
db-name
db-username
db-password)
(postmodern:with-connection (list db-name db-username db-password db-host :use-ssl t)
(with-backplane xmpp-host xmpp-username xmpp-password
(lambda (backplane)
@ -197,8 +200,8 @@
(let ((input (open filename :if-does-not-exist nil)))
(read-line input)))
(defun start-backplane-dns-listener-with-env ()
(backplane-dns-listen
(defun start-listener-with-env ()
(listen
(getenv-or-fail "FUDO_DNS_BACKPLANE_XMPP_HOSTNAME" "backplane.fudo.org")
(getenv-or-fail "FUDO_DNS_BACKPLANE_XMPP_USERNAME" "dns")
(read-file-line (getenv-or-fail "FUDO_DNS_BACKPLANE_XMPP_PASSWORD_FILE"))