@nodeart/cloudflare-provisioning 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +9 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -36,6 +36,7 @@ async function applyCloudflareSettings (config) {
36
36
 
37
37
  const accountEmail = process.env.CLOUDFLARE_EMAIL
38
38
  const accountKey = process.env.CLOUDFLARE_API_KEY
39
+ const accountToken = process.env.CLOUDFLARE_TOKEN
39
40
 
40
41
  if (config.enabled === false) {
41
42
  console.log('Config is disabled and would not be applied:', config.domains)
@@ -50,9 +51,14 @@ async function applyCloudflareSettings (config) {
50
51
  throw new Error('Cloudflare zone ID is not defined')
51
52
  }
52
53
 
53
- const options = site.token === undefined
54
- ? { email: accountEmail, apiKey: accountKey }
55
- : { token: site.token }
54
+ let options
55
+ if (site.token) {
56
+ options = { token: site.token }
57
+ } else if (accountToken) {
58
+ options = { token: accountToken }
59
+ } else {
60
+ options = { email: accountEmail, apiKey: accountKey }
61
+ }
56
62
 
57
63
  const cloudFlare = new CloudFlare(zoneId, site.domain, options)
58
64
  const domainSettings = substituteDomainName(settings, site.domain)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodeart/cloudflare-provisioning",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {