Subject: Re: [bug#37083] [PATCH] machine: Implement 'digital-ocean-environment-type'.

From: Ludovic Courtès <[email-masked]>
Date: Sun, 29 Sep 2019 00:36:10 +0200

Hi Jakob!

[email-masked] (Jakob L. Kreuze) skribis:

> gnu/machine/digital-ocean.scm: New file.
> gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
> doc/guix.texi (Invoking 'guix deploy'): Add documentation for
  ^
Nitpick: please add a “*” before each bullet.  :-)

Apart from that, LGTM, woohoo!

> +(define (fetch-endpoint endpoint)
> +  "Return the contents of the Digital Ocean API endpoint ENDPOINT as an
> +alist. This procedure is quite a bit more specialized than 'json-fetch', as it
> +takes care to set headers such as 'Accept' and 'Authorization' appropriately."
> +  (define headers
> +    `((user-agent . "Guix Deploy")
> +      (Accept . "application/json")
> +      (Authorization . ,(format #f "Bearer ~a" (%digital-ocean-token)))))
> +  (json-fetch (string-append %api-base endpoint) #:headers headers))

Note for later: we could use ‘define-json-mapping’ to work on Scheme
records rather than on alists.

> +             (message (G_ "No Digital Ocean access token was provided. This \
> +may be fixed by setting the environment variable GUIX_DIGITAL_OCAEN_TOKEN to \
                                                                   ^^
Typo.

Thank you!

Ludo’.