aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-12-10 10:48:40 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-12-10 10:48:40 +0100
commitf576e74ce6891ce05882d536428f9bf9979910a2 (patch)
treee74e7c4a2ab1d9249aceea9849c03c3faef93f32
parenteca7ca4838b91bb4d1c64fbc8d8b45ae07510ae9 (diff)
Bikeshedding: use select
-rw-r--r--account.go8
-rw-r--r--acme.conf8
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