GNU bug report logs -
#51216
[PATCH 0/1] swh: Allows token from Software Heritage authentication service.
Previous Next
Reported by: zimoun <zimon.toutoune <at> gmail.com>
Date: Thu, 14 Oct 2021 21:33:01 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #14 received at 51216 <at> debbugs.gnu.org (full text, mbox):
zimoun <zimon.toutoune <at> gmail.com> skribis:
> The token is provided using the environment variable GUIX_SWH_TOKEN.
>
> * guix/swh.scm (swh-token): New variable.
> (http-get*, http-post*): Use it.
[...]
> +;; Token from an account to the Software Heritage Authentication service
> +;; <https://archive.softwareheritage.org/api/>
> +(define swh-token
> + (match (getenv "GUIX_SWH_TOKEN")
> + (#f #f)
> + ((? string-null? s) #f)
> + ((? string? s) (string->symbol s))))
Could you turn it into a SRFI-39 parameter?
> ;; XXX: Work around a bug in Guile 3.0.2 where #:verify-certificate? would
> ;; be ignored (<https://bugs.gnu.org/40486>).
> (define* (http-get* uri #:rest rest)
> - (apply http-request uri #:method 'GET rest))
> + (apply http-request uri #:method 'GET
> + #:headers
> + (if swh-token
> + `((authorization . (Bearer ,swh-token)))
> + '())
> + rest))
> (define* (http-post* uri #:rest rest)
> - (apply http-request uri #:method 'POST rest))
> + (apply http-request uri #:method 'POST
> + #:headers
> + (if swh-token
> + `((authorization . (Bearer ,swh-token)))
> + '())
> + rest))
These two procedures are meant to go away as soon as Guile > 3.0.2 is
required.
Could you instead pass #:headers in the ‘call’ procedure, and maybe in
‘vault-fetch’ too?
Thanks!
Ludo’.
This bug report was last modified 3 years and 219 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.