🌳
pt0/deployF/hostnameF/cfEnsureSslFullAI.mts
6const targetSslMode = 'strict' // Full (Strict) - requires valid LE cert on origin
8export const cfensuressl = async () => {
9 const {cfApiKeySecretName, domainNames} = getKlusterCtx()
11 const headers = getCfHeaders({cfApiKeySecretName})
13 const zones = await cfFetch('/zones', headers)
15 for (const domainName of domainNames!) {
16 const zone = zones.find((z: any) => z.name === domainName)
17 if (!zone) { console.log(`⚠️ zone not found: ${domainName}`); continue }
19 const sslSetting = await cfFetch(`/zones/${zone.id}/settings/ssl`, headers)
20 const currentValue = sslSetting.value
22 if (currentValue === targetSslMode) {
23 console.log(`✓ ${domainName} ssl=${currentValue}`)
24 continue
25 }
27 await cfFetch(`/zones/${zone.id}/settings/ssl`, headers, {
28 method: 'PATCH',
29 body: JSON.stringify({value: targetSslMode}),
30 })
31 betLog({domainName, sslMode: `${currentValue} → ${targetSslMode}`})
32 }
35cfensuressl.cliDescript = 'ensure CF zone SSL mode is Full (Strict) for all cluster domains'