small code improvements
This commit is contained in:
parent
9707b4dac8
commit
d1c2dd4dcf
|
@ -1,3 +1,8 @@
|
|||
0.0.4-beta / 2015-12-13
|
||||
=======================
|
||||
|
||||
* Small code improvements
|
||||
|
||||
0.0.3-beta / 2015-12-13
|
||||
=======================
|
||||
|
||||
|
|
|
@ -112,14 +112,14 @@ function getCert(options, cb) {
|
|||
options.newReg=options.newReg || 'https://acme-v01.api.letsencrypt.org/acme/new-reg';
|
||||
|
||||
if (!options.email) {
|
||||
return cb(new Error('No "email" option given!'));
|
||||
return cb(new Error('No "email" option specified!'));
|
||||
}
|
||||
if (typeof options.domains==='string') {
|
||||
state.domains=options.domains.split(/[, ]+/);
|
||||
} else if (options.domains && options.domains instanceof Array) {
|
||||
state.domains=options.domains.slice();
|
||||
} else {
|
||||
return cb(new Error('No valid "domains" option given!'));
|
||||
return cb(new Error('No valid "domains" option specified!'));
|
||||
}
|
||||
|
||||
if ((_DEBUG=options.debug)) {
|
||||
|
@ -235,7 +235,7 @@ function getCert(options, cb) {
|
|||
var links, authz, httpChallenges, challenge, thumbprint, keyAuthorization, challengePath;
|
||||
|
||||
if (err || Math.floor(res.statusCode/100)!==2) {
|
||||
return handleErr(err, 'Authorization request failed with code '+res.statusCode);
|
||||
return handleErr(err, 'Authorization request failed ('+res.statusCode+')');
|
||||
}
|
||||
|
||||
links=parseLink(res.headers['link']);
|
||||
|
@ -344,7 +344,7 @@ function getCert(options, cb) {
|
|||
|
||||
links=parseLink(res.headers['link']);
|
||||
if (!links || !('up' in links)) {
|
||||
return handleErr(err, 'Failed to fetch CA certificate');
|
||||
return handleErr(err, 'Failed to fetch issuer certificate');
|
||||
}
|
||||
|
||||
log('Requesting certificate: done');
|
||||
|
@ -365,16 +365,16 @@ function getCert(options, cb) {
|
|||
handleErr(null, 'Cert at '+certURL+' did not match returned cert');
|
||||
} else {
|
||||
log('Successfully verified cert at '+certURL);
|
||||
log('Requesting CA certificate...');
|
||||
log('Requesting issuer certificate...');
|
||||
request.get({
|
||||
url:links['up'],
|
||||
encoding:null
|
||||
}, function(err, res, body) {
|
||||
if (err || res.statusCode!==200) {
|
||||
return handleErr(err, 'Failed to fetch CA certificate');
|
||||
return handleErr(err, 'Failed to fetch issuer certificate');
|
||||
}
|
||||
state.caCert=certBufferToPEM(body);
|
||||
log('Requesting CA certificate: done');
|
||||
log('Requesting issuer certificate: done');
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ function getCert(options, cb) {
|
|||
}
|
||||
cb(null, cert, state.certPrivateKeyPEM, state.caCert);
|
||||
} catch(err) {
|
||||
handleErr(err, 'Could not write output files');
|
||||
handleErr(err, 'Could not write output files. Please check permissions!');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
{
|
||||
"name": "letiny",
|
||||
"version": "0.0.3-beta",
|
||||
"version": "0.0.4-beta",
|
||||
"description": "Tiny ACME client library and CLI",
|
||||
"author": "Anatol Sommer <anatol@anatol.at>",
|
||||
"license": "MPL",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/anatolsommer/letiny.git"
|
||||
},
|
||||
"keywords": [
|
||||
"tiny",
|
||||
"acme",
|
||||
|
|
Loading…
Reference in New Issue