minor fixes

This commit is contained in:
AJ ONeal 2015-12-20 03:31:05 +00:00
parent 9b84d88a8c
commit a6b1b5cfa6
2 changed files with 20 additions and 12 deletions

View File

@ -64,6 +64,7 @@ function createAccount(args, handlers) {
pems.privateKey = pems.privateKeyJwk;
pems.regr = regr;
pems.accountId = accountId;
pems.id = accountId;
return pems;
});
});
@ -99,25 +100,27 @@ function getAccount(accountId, args, handlers) {
return !files[key].error;
})) {
// TODO log renewal.conf
console.warn("Account '" + accountId + "' was currupt. No big deal (I think?). Creating a new one...");
console.warn("Account '" + accountId + "' was corrupt. No big deal (I think?). Creating a new one...");
//console.log(accountId, files);
return createAccount(args, handlers);
}
return leCrypto.privateJwkToPemsAsync(files.private_key).then(function (keypair) {
files.accountId = accountId; // preserve current account id
files.id = accountId;
files.publicKeySha256 = keypair.publicKeySha256;
files.publicKeyMd5 = keypair.publicKeyMd5;
files.publicKeyPem = keypair.publicKeyPem; // ascii PEM: ----BEGIN...
files.privateKeyPem = keypair.privateKeyPem; // ascii PEM: ----BEGIN...
files.privateKeyJson = keypair.private_key; // json { n: ..., e: ..., iq: ..., etc }
files.privateKeyJwk = keypair.private_key; // json { n: ..., e: ..., iq: ..., etc }
files.privateKeyJson = keypair.privateKeyJwk; // json { n: ..., e: ..., iq: ..., etc }
files.privateKeyJwk = keypair.privateKeyJwk; // json { n: ..., e: ..., iq: ..., etc }
return files;
});
});
}
function getAccountIdByEmail(args, handlers) {
function getAccountIdByEmail(args) {
// If we read 10,000 account directories looking for
// just one email address, that could get crazy.
// We should have a folder per email and list
@ -171,7 +174,7 @@ function getAccountIdByEmail(args, handlers) {
}).then(function (accountId) {
return accountId;
}, function (err) {
if ('ENOENT' == err.code) {
if ('ENOENT' === err.code) {
// ignore error
return null;
}

View File

@ -54,10 +54,15 @@ function writeCertificateAsync(result, args, defaults, handlers) {
var certPath = args.certPath || obj.cert || path.join(liveDir, 'cert.pem');
var fullchainPath = args.fullchainPath || obj.fullchain || path.join(liveDir, 'fullchain.pem');
var chainPath = args.chainPath || obj.chain || path.join(liveDir, 'chain.pem');
var privkeyPath = args.domainPrivateKeyPath || args.domainKeyPath
|| obj.privkey || obj.keyPath
var privkeyPath = args.privkeyPath || obj.privkey
//|| args.domainPrivateKeyPath || args.domainKeyPath || obj.keyPath
|| path.join(liveDir, 'privkey.pem');
if (args.debug) {
console.log('################ privkeyPath ################');
console.log(privkeyPath);
}
var archiveDir = args.archiveDir || path.join(args.configDir, 'archive', args.domains[0]);
var checkpoint = obj.checkpoint.toString();
@ -86,7 +91,9 @@ function writeCertificateAsync(result, args, defaults, handlers) {
obj.checkpoint += 1;
var updates = {
cert: certPath
account: args.accountId || args.account.id
, cert: certPath
, privkey: privkeyPath
, chain: chainPath
, fullchain: fullchainPath
@ -107,7 +114,6 @@ function writeCertificateAsync(result, args, defaults, handlers) {
// TODO XXX end
// yes, it's an array. weird, right?
, webrootPath: args.webrootPath && [args.webrootPath] || []
, account: args.account.accountId
, server: args.server || args.acmeDiscoveryUrl
, logsDir: args.logsDir
};
@ -156,7 +162,6 @@ function getCertificateAsync(account, args, defaults, handlers) {
}
args.domainPrivateKeyPem = domainKey.privateKeyPem;
args.account = account;
//args.registration = domainKey;
return LeCore.getCertificateAsync({
@ -321,8 +326,8 @@ module.exports.create = function (defaults, handlers) {
console.log('[LE DEBUG] reg domains', args.domains);
}
return getOrCreateAcmeAccount(copy, defaults, handlers).then(function (account) {
console.log('AAAAAAAAAACCCCCCCCCCCCCCCCOOOOOOOOOOOOOOUUUUUUUUUUUUUUUNNNNNNNNNNNNNNNNTTTTTTTTTTTT');
console.log(account);
console.log("account", account);
args.account = account;
return getOrCreateDomainCertificate(account, copy, defaults, handlers);
});
}