From f576e74ce6891ce05882d536428f9bf9979910a2 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Thu, 10 Dec 2015 10:48:40 +0100 Subject: Bikeshedding: use select --- account.go | 8 +++++--- acme.conf | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/account.go b/account.go index d116bed..a17d931 100644 --- a/account.go +++ b/account.go @@ -33,7 +33,7 @@ func NewAccount(email string, bits int) (*Account, error) { return &Account{ Contact: []string{"mailto:" + m.Address}, PrivKey: key, - nonce: make(chan string, 100), + nonce: make(chan string, 10), // shall be enough }, nil } @@ -67,10 +67,12 @@ var errNoNonces = errors.New("No nonces available") // Nonce implements jose nonce provider func (a Account) Nonce() (string, error) { - if nonce, ok := <-a.nonce; ok { + select { + case nonce := <-a.nonce: return nonce, nil + default: + return "", errNoNonces } - return "", errNoNonces } func (a Account) parseNonce(r *http.Response) { diff --git a/acme.conf b/acme.conf index 99fb3c5..7ec1a60 100644 --- a/acme.conf +++ b/acme.conf @@ -6,7 +6,7 @@ provider lev1 https://acme-v01.api.letsencrypt.org/directory provider les https://acme-staging.api.letsencrypt.org/directory default # account definitions -account another@example.com key /etc/another.key default +account webmaster@example.com key /etc/webmaster.key default account mailmaster@example.com key /etc/mailmaster.key # hook definitions @@ -15,7 +15,7 @@ hook dovecot "sudo service dovecot reload" # desire definitions desire { www.example.com, example.com, www2.example.com } from les \ - with another@example.com \ + as webmaster@example.com \ key /etc/ssl/private/www_example_com.key \ cert /etc/ssl/cert/www_example_com.pem \ webroot /var/www/htdocs \ @@ -23,12 +23,12 @@ desire { www.example.com, example.com, www2.example.com } from les \ # desire with prefix www imples altname without www desire www.example.net from les \ - with another@example.com \ + as webmaster@example.com \ key /etc/ssl/private/www_example_net.key \ cert /etc/ssl/cert/www_example_net.pem desire mail.example.com from les \ - with mailmaster@example.com \ + as mailmaster@example.com \ key /etc/ssl/private/mail_example_com.key \ cert /etc/ssl/cert/mail_example_com.pem \ hook dovecot -- cgit v1.2.3