diff --git a/src/cuirass/mastodon.scm b/src/cuirass/mastodon.scm index 1cfa6b434c955704debbcb1c1a00a87458aadb91..be74bc8e7a60830199b818cea270159c754da640 100644 --- a/src/cuirass/mastodon.scm +++ b/src/cuirass/mastodon.scm @@ -17,18 +17,15 @@ ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. (define-module (cuirass mastodon) + #:use-module (cuirass parameters) #:use-module (mastodon) #:use-module (mastodon types) #:export (send-status)) -(define* (send-status text - #:key - instance-name - instance-url - instance-token) +(define (send-status text) "Send a new status with the given TEXT to the instance named INSTANCE-NAME at the INSTANCE-URL address. Use the given INSTANCE-TOKEN to authenticate." - (let ((instance (make-mastodon instance-name - instance-url - instance-token))) + (let ((instance (make-mastodon (%mastodon-instance-name) + (%mastodon-instance-url) + (%mastodon-instance-token)))) (new-status instance #:status text))) diff --git a/src/cuirass/notification.scm b/src/cuirass/notification.scm index 262b90dc5c56ade00c4f873a1fcc5f1f29ce059d..fc983cb1c0095c86ef5b4c765c2723d464cc09d9 100644 --- a/src/cuirass/notification.scm +++ b/src/cuirass/notification.scm @@ -113,14 +113,8 @@ the detailed information about this build here: ~a." (define (notification-mastodon notification) "Send a new status for the given NOTIFICATION." - (let ((name (assq-ref notification #:instance-name)) - (url (assq-ref notification #:instance-url)) - (token (assq-ref notification #:instance-token)) - (text (notification-text notification))) - (send-status text - #:instance-name name - #:instance-url url - #:instance-token token))) + (let ((text (notification-text notification))) + (send-status text))) (define* (send-notifications notifications #:key build) "Send the notifications in NOTIFICATIONS list, regarding the given BUILD." diff --git a/src/cuirass/parameters.scm b/src/cuirass/parameters.scm index e9be8a37c3b58790fc4a65f2ec1d81dba3cba726..fb580bf7ac6b8d38434218ae74e6393105dc4c22 100644 --- a/src/cuirass/parameters.scm +++ b/src/cuirass/parameters.scm @@ -20,7 +20,10 @@ #:export (%cuirass-url %zabbix-url %zabbix-user - %zabbix-password)) + %zabbix-password + %mastodon-instance-name + %mastodon-instance-url + %mastodon-instance-token)) ;; The URL of the Cuirass web server. This is useful to send absolute links ;; within notifications. @@ -39,3 +42,15 @@ ;; The password for Zabbix API authentication. (define %zabbix-password (make-parameter "zabbix")) + +;; The name of the Mastodon instance used to send build notifications. +(define %mastodon-instance-name + (make-parameter #f)) + +;; The URL of the Mastodon instance. +(define %mastodon-instance-url + (make-parameter #f)) + +;; The token used to authenticate on the Mastodon instance. +(define %mastodon-instance-token + (make-parameter #f))