Reformat code
This commit is contained in:
parent
aa90e66b7c
commit
88e3470f1f
1 changed files with 9 additions and 11 deletions
10
src/sni.js
10
src/sni.js
|
|
@ -55,8 +55,7 @@ async function buildCache(host) {
|
|||
key,
|
||||
expire
|
||||
};
|
||||
}
|
||||
catch (error) {
|
||||
} catch (error) {
|
||||
// only one process can generate certificate at a time
|
||||
return await lock.acquire('cert', async () => {
|
||||
const {certificate, privateKeyData} = await client.generateCertificate(host);
|
||||
|
|
@ -100,20 +99,19 @@ async function SniListener(servername, ctx) {
|
|||
// Generate fresh account keys for Let's Encrypt
|
||||
try {
|
||||
ctx(null, tls.createSecureContext(await getKeyCert(servername)));
|
||||
}
|
||||
catch (error) {
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
ctx(error, undefined);
|
||||
}
|
||||
}
|
||||
|
||||
const SniPrepare = async () => {
|
||||
await ensureDir(certsDir);
|
||||
await ensureDir(accountDir);
|
||||
if (fs.existsSync(path.join(accountDir, 'privateKey.pem')) &&
|
||||
fs.existsSync(path.join(accountDir, 'publicKey.pem'))) {
|
||||
await client.importAccountKeyPair(accountDir, '');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
await client.generateAccountKeyPair();
|
||||
await client.exportAccountKeyPair(accountDir, '');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue