From 56627e7b394f2bf712f8c577eeb15f809fed07e5 Mon Sep 17 00:00:00 2001 From: Niten Date: Wed, 11 Nov 2020 10:52:09 -0800 Subject: [PATCH] Added back hostname-rx (still used) and renamed listen functions. --- backplane-dns.asd | 2 +- backplane-dns.lisp | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/backplane-dns.asd b/backplane-dns.asd index c264589..cc4d683 100644 --- a/backplane-dns.asd +++ b/backplane-dns.asd @@ -1,4 +1,4 @@ -;;;; dns-backplane.asd +;;;; backplane-dns.asd (asdf:defsystem #:backplane-dns :description "Server to listen on Fudo backplane for DNS updates" diff --git a/backplane-dns.lisp b/backplane-dns.lisp index c928592..91bf473 100644 --- a/backplane-dns.lisp +++ b/backplane-dns.lisp @@ -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"))