mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
update script
This commit is contained in:
15046
init-script/package-lock.json
generated
15046
init-script/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -16,6 +16,7 @@
|
||||
"body-parser": "^1.19.0",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.17.1",
|
||||
"moment": "^2.29.1",
|
||||
"mongodb": "^3.5.2",
|
||||
"nanoid": "^1.3.0",
|
||||
"slugify": "^1.4.7",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const { find, save } = require('../util/db');
|
||||
const moment = require('moment');
|
||||
|
||||
const statusPageCollection = 'statuspages';
|
||||
const siteManagerCollection = 'sitemanagers';
|
||||
@@ -12,21 +13,25 @@ async function run() {
|
||||
});
|
||||
|
||||
for (const statusPage of statusPages) {
|
||||
const domains = statusPage.domains
|
||||
const currentDate = new Date(moment().format());
|
||||
const domainsToSave = statusPage.domains
|
||||
.filter(
|
||||
domainObj => domainObj.enableHttps && domainObj.autoProvisioning
|
||||
domainObj =>
|
||||
domainObj.enableHttps &&
|
||||
domainObj.autoProvisioning &&
|
||||
domainObj.domain
|
||||
)
|
||||
.map(domainObj => domainObj.domain);
|
||||
|
||||
for (const domain of domains) {
|
||||
// default renewAt to 1
|
||||
// cert should be renewed within 24 hours
|
||||
await save(siteManagerCollection, {
|
||||
subject: domain,
|
||||
altnames: [domain],
|
||||
.map(domainObj => ({
|
||||
subject: domainObj.domain,
|
||||
altnames: [domainObj.domain],
|
||||
renewAt: 1,
|
||||
});
|
||||
}
|
||||
createdAt: currentDate,
|
||||
updatedAt: currentDate,
|
||||
}));
|
||||
|
||||
// default renewAt to 1
|
||||
// cert should be renewed within 24 hours
|
||||
await save(siteManagerCollection, domainsToSave);
|
||||
}
|
||||
|
||||
return `Script ran for ${statusPages.length} status pages`;
|
||||
|
||||
Reference in New Issue
Block a user