clean up supabase, MAM automation continues.
This commit is contained in:
@@ -22,37 +22,6 @@
|
||||
400
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "getAll",
|
||||
"tableId": "npm_tokens",
|
||||
"limit": 1,
|
||||
"matchType": "allFilters",
|
||||
"filters": {
|
||||
"conditions": [
|
||||
{
|
||||
"keyName": "service_name",
|
||||
"condition": "eq",
|
||||
"keyValue": "npm_dfw"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "get-npm-token",
|
||||
"name": "Get NPM Token",
|
||||
"type": "n8n-nodes-base.supabase",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
448,
|
||||
400
|
||||
],
|
||||
"credentials": {
|
||||
"supabaseApi": {
|
||||
"id": "lWyf2ikOGHTTwnSU",
|
||||
"name": "Supabase account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Process SSL certificates and check expiration\nconst certificates = $input.all();\nconst today = new Date();\nconst WARNING_DAYS = 7;\n\nconsole.log('=== NPM SSL Certificate Monitor ===');\nconsole.log('Total certificates:', certificates.length);\n\nconst certificateStatus = [];\nlet expiringCerts = [];\nlet skippedCount = 0;\n\nfor (const item of certificates) {\n const cert = item.json;\n \n // Skip if no expiration date or invalid\n if (!cert.expires_on || cert.expires_on === 0) {\n console.log('Skipping certificate (no expiration):', cert.nice_name || cert.id);\n skippedCount++;\n continue;\n }\n \n const domainNames = cert.domain_names?.join(', ') || cert.nice_name || `Certificate ${cert.id}`;\n \n // Create date and validate it\n const expiryDate = new Date(cert.expires_on * 1000);\n if (isNaN(expiryDate.getTime())) {\n console.log('Skipping certificate (invalid date):', domainNames);\n skippedCount++;\n continue;\n }\n \n const daysRemaining = Math.ceil((expiryDate - today) / (1000 * 60 * 60 * 24));\n const isExpiring = daysRemaining <= WARNING_DAYS;\n \n let status = 'OK';\n if (daysRemaining < 0) {\n status = 'EXPIRED';\n } else if (isExpiring) {\n status = 'EXPIRING SOON';\n }\n \n const certInfo = {\n domain: domainNames,\n expiryDate: expiryDate.toISOString().split('T')[0],\n daysRemaining: daysRemaining,\n status: status,\n isExpiring: isExpiring\n };\n \n certificateStatus.push(certInfo);\n \n if (isExpiring) {\n expiringCerts.push(certInfo);\n console.log(`🔴 ${domainNames}: ${daysRemaining} days (expires ${certInfo.expiryDate})`);\n } else {\n console.log(`✅ ${domainNames}: ${daysRemaining} days`);\n }\n}\n\nconsole.log('\\n=== Summary ===');\nconsole.log('Valid certificates:', certificateStatus.length);\nconsole.log('Skipped (invalid/missing expiration):', skippedCount);\nconsole.log('Expiring within', WARNING_DAYS, 'days:', expiringCerts.length);\n\nreturn [{\n json: {\n totalCerts: certificateStatus.length,\n expiringCount: expiringCerts.length,\n hasExpiringCerts: expiringCerts.length > 0,\n allCertificates: certificateStatus,\n expiringCertificates: expiringCerts\n }\n}];"
|
||||
@@ -169,6 +138,45 @@
|
||||
640,
|
||||
400
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "select",
|
||||
"schema": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "public"
|
||||
},
|
||||
"table": {
|
||||
"__rl": true,
|
||||
"value": "npm_tokens",
|
||||
"mode": "list",
|
||||
"cachedResultName": "npm_tokens"
|
||||
},
|
||||
"where": {
|
||||
"values": [
|
||||
{
|
||||
"column": "service_name",
|
||||
"value": "npm_dfw"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.postgres",
|
||||
"typeVersion": 2.6,
|
||||
"position": [
|
||||
448,
|
||||
400
|
||||
],
|
||||
"id": "18c7d30b-bd5e-450c-9800-4f883c641b1c",
|
||||
"name": "Select rows from a table",
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "Ik8CFyap8ic2Md3M",
|
||||
"name": "n8n-infra"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
@@ -176,18 +184,7 @@
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get NPM Token",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get NPM Token": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Fetch Certificates",
|
||||
"node": "Select rows from a table",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
@@ -209,7 +206,7 @@
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get NPM Token",
|
||||
"node": "Select rows from a table",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
@@ -248,6 +245,17 @@
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Select rows from a table": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Fetch Certificates",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
@@ -258,7 +266,7 @@
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"triggerCount": 1,
|
||||
"versionId": "708d8124-5275-445c-92da-43b0f43e9826",
|
||||
"versionId": "67bbccd4-8c5e-4cc5-8969-9460ed529b23",
|
||||
"owner": {
|
||||
"type": "personal",
|
||||
"projectId": "FeLO36wNUAcn61Wj",
|
||||
|
||||
Reference in New Issue
Block a user