Skip to content

Commit 46b9ffe

Browse files
committed
fix: log
1 parent 225c779 commit 46b9ffe

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

src/commands/other/nodeCertManager.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ async function checkDns(host) {
2121
}
2222
if (err)
2323
console.log(host, err);
24-
});
25-
} catch(err) {
24+
});
25+
} catch (err) {
2626
console.log('certificate', err)
2727
}
2828
});
@@ -33,29 +33,29 @@ async function createCert(host) {
3333
// let hosts = await exec(`sudo openssl x509 -dates -noout -in /etc/letsencrypt/live/${host}/fullchain.pem`);
3434
// console.log('hostst check', hosts)
3535
let test = await checkDns(host)
36-
console.log('checked dns from creatCert', test)
36+
console.log('checked dns from createCert', test)
3737
if (test) {
3838
await exec(`sudo certbot certonly --manual -d *.${host} -d ${host} --agree-tos --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory`);
3939
let exitCode = await spawn('sudo', ['certbot', 'certonly', '--manual', '-d', `*.${host}`, '-d', host, '--agree-tos', '--preferred-challenges', 'dns-01', '--server', 'https://acme-v02.api.letsencrypt.org/directory'], { stdio: 'inherit', cwd: process.cwd() })
4040
if (exitCode !== 0) {
4141
failed.push({ name: false, des: `creating directory failed` })
42-
} else
42+
} else
4343
console.log(true)
4444

4545
// return true
46-
} else
46+
} else
4747
return false
48-
} catch(err) {
49-
return false
48+
} catch (err) {
49+
return false
5050
}
5151
}
5252

5353
async function deleteCert(host) {
5454
try {
5555
await exec(`sudo certbot delete --cert-name ${host}`);
5656
return true
57-
} catch(err) {
58-
return false
57+
} catch (err) {
58+
return false
5959
}
6060
}
6161

@@ -74,10 +74,10 @@ async function checkCert(host) {
7474
let currentDate = new Date()
7575

7676
if (!issued || !expires)
77-
console.log('not defined', {issued, expires})
77+
console.log('not defined', { issued, expires })
7878
else if (!isNaN(expires)) {
7979
if (currentDate < expires) {
80-
certificates.set(host, {issued, expires})
80+
certificates.set(host, { issued, expires })
8181
return true
8282
} else {
8383
let cert = await createCert(host)
@@ -88,23 +88,23 @@ async function checkCert(host) {
8888
return cert
8989
}
9090
}
91-
} catch(err) {
91+
} catch (err) {
9292
let cert = await createCert(host)
9393
if (cert)
94-
certificates.set(host, {issued, expires})
94+
certificates.set(host, { issued, expires })
9595
return cert
9696
}
9797
}
9898

9999
async function test(host) {
100100
try {
101-
101+
102102

103103
await exec(`sudo certbot certonly --manual --test-cert -d *.${host} -d ${host} --agree-tos --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory`);
104104
let exitCode = await spawn('sudo', ['certbot', 'certonly', '--manual', '--test-cert', '-d', `*.${host}`, '-d', host, '--agree-tos', '--preferred-challenges', 'dns-01', '--server', 'https://acme-v02.api.letsencrypt.org/directory'], { stdio: 'inherit', cwd: process.cwd() })
105105
if (exitCode !== 0) {
106106
failed.push({ name: false, des: `creating directory failed` })
107-
} else
107+
} else
108108
console.log(true)
109109

110110
// let child = exec('su -')
@@ -113,9 +113,9 @@ async function test(host) {
113113
// child.stdout.on('data', (data) => {
114114
// console.log(`stdout: "${data}"`);
115115
// });
116-
116+
117117
// child.stdin.end(); // EOF
118-
118+
119119
// child.on('close', (code) => {
120120
// console.log(`Child process exited with code ${code}.`);
121121
// });
@@ -136,13 +136,13 @@ async function test(host) {
136136

137137
// return true
138138
// return false
139-
} catch(err) {
139+
} catch (err) {
140140
process.exit(1)
141-
// return false
141+
// return false
142142
}
143143
}
144144

145145

146146
test('cocreate.app')
147147

148-
module.exports = {checkDns, checkCert, createCert, deleteCert}
148+
module.exports = { checkDns, checkCert, createCert, deleteCert }

0 commit comments

Comments
 (0)