Skip to content
This repository was archived by the owner on Aug 21, 2019. It is now read-only.

Commit 6cde205

Browse files
committed
ensure that the script exist with 0 if all certificates are valid
1 parent 01b0f3e commit 6cde205

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ module.exports = (options) => {
139139
pagesDomains.every(hasValidCertificate);
140140

141141
if (needsNoRenewal) {
142-
return Promise.reject(`All domains (${options.domain.join(', ')}) have a valid certificate (expiration in more than ${EXPIRATION_IN_DAYS} days)`);
142+
143+
const error = new Error(`All domains (${options.domain.join(', ')}) have a valid certificate (expiration in more than ${EXPIRATION_IN_DAYS} days)`);
144+
error.exitCode = 0;
145+
146+
return Promise.reject(error);
143147
}
144148

145149
// promises to create the new domains

main.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ module.exports = (args) => {
1313
console.log(`This certificate expires on ${certs.notAfter}. You will need to run gitlab-le again at some time before this date.`);
1414
}
1515
}).catch(err => {
16+
17+
if(err.exitCode !== undefined) {
18+
console.log(err.detail || err.message || err);
19+
process.exit(err.exitCode);
20+
}
21+
1622
console.error(err.detail || err.message || err);
23+
1724
process.exit(1);
1825
});
1926
};

0 commit comments

Comments
 (0)