netlify-purge-cloudflare-on-deploy
Advanced tools
Comparing version 1.0.2 to 1.0.3
10
index.js
const fetch = require('node-fetch'); | ||
const { | ||
env: { CLOUDFLARE_API_KEY, CLOUDFLARE_ZONE_ID, CLOUDFLARE_EMAIL }, | ||
} = require('process'); | ||
module.exports = { | ||
@@ -11,6 +15,6 @@ async onEnd({ | ||
console.log('Preparing to trigger Cloudflare cache purge'); | ||
let baseUrl = `https://api.cloudflare.com/client/v4/zones/${inputs.zoneId}/purge_cache`; | ||
let baseUrl = `https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE_ID}/purge_cache`; | ||
let headers = { | ||
'X-Auth-Email': inputs.cloudflareEmail, | ||
'X-Auth-Key': inputs.cloudflareApiKey, | ||
'X-Auth-Email': CLOUDFLARE_EMAIL, | ||
'X-Auth-Key': CLOUDFLARE_API_KEY, | ||
'Content-Type': 'application/json', | ||
@@ -17,0 +21,0 @@ }; |
{ | ||
"name": "netlify-purge-cloudflare-on-deploy", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Automatically purge Cloudflare cache on Netlify deploy.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,2 +11,7 @@ # netlify-purge-cloudflare-on-deploy | ||
In Netlify, go to Seetings -> Build & Deploy -> Environment -> Environment variables and set up: | ||
* CLOUDFLARE_EMAIL | ||
* CLOUDFLARE_ZONE_ID | ||
* CLOUDFLARE_API_KEY | ||
## netlify.toml template | ||
@@ -16,5 +21,1 @@ | ||
package = "./plugins/netlify-purge-cloudflare-on-deploy" | ||
[plugins.inputs] | ||
cloudflareEmail = "cloudflare@email.com" | ||
cloudflareApiKey = "yourApiKey" | ||
zoneId = "yourZoneId" |
Sorry, the diff of this file is not supported yet
36
20
3332