guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: Use parameters for the Mastodon crendentials.


From: Mathieu Othacehe
Subject: branch master updated: Use parameters for the Mastodon crendentials.
Date: Mon, 22 Feb 2021 04:17:22 -0500

This is an automated email from the git hooks/post-receive script.

mothacehe pushed a commit to branch master
in repository guix-cuirass.

The following commit(s) were added to refs/heads/master by this push:
     new 342c5ed  Use parameters for the Mastodon crendentials.
342c5ed is described below

commit 342c5edfe8c372f916aa82a486943086158f4e1a
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Mon Feb 22 10:15:58 2021 +0100

    Use parameters for the Mastodon crendentials.
    
    * src/cuirass/parameters.scm (%mastodon-instance-name, 
%mastodon-instance-url,
    %mastodon-instance-token): New variables.
    * src/cuirass/mastodon.scm (send-status): Remove "instance-name",
    "instance-url" and "instance-token" parameters.
    * src/cuirass/notification (notification-mastodon): Adapt accordingly.
---
 src/cuirass/mastodon.scm     | 13 +++++--------
 src/cuirass/notification.scm | 10 ++--------
 src/cuirass/parameters.scm   | 17 ++++++++++++++++-
 3 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/src/cuirass/mastodon.scm b/src/cuirass/mastodon.scm
index 1cfa6b4..be74bc8 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 262b90d..fc983cb 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 e9be8a3..fb580bf 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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]