Comments (3)
In this case, I'm proposing what I think is the simplest change, which would be to allow the token to be overriden per call.
You can already override credentials on a per-request basis using the Cloudflare Node.js bindings. An optional additional argument containing token
, key
, and email
can be passed, and they'll be used for that request. This has been supported since v2.0.0.
Adapting the example from the README:
var cf = require('cloudflare')({
token: 'your Cloudflare API token'
});
await cf.zones.read('023e105f4ecef8ad9ca31a8372d0c353', {
token: 'different API token'
});
In the current API model, zones can only be accessed by their ID (not by the DNS name), which can only be obtained with a call to zones.browse().
In the case of auto-wildcard SSL with Let's Encrypt,you likely have a well-known list of domains you're renewing for. The zone IDs don't change, and can be obtained from the dashboard, so you can avoid zones.browse
if necessary.
Though in terms of what CloudFlare as a whole should do, I think a token's permissions should be more flexible
Please make sure to make this suggestion to Cloudflare Support, so this idea can get to the teams responsible.
from node-cloudflare.
You can already override credentials on a per-request basis using the Cloudflare Node.js bindings. An optional additional argument containing token, key, and email can be passed, and they'll be used for that request. This has been supported since v2.0.0.
Good. Then the jsdocs should probably be updated to reflect that, as there's nothing in them to hint this is possible.
In the case of auto-wildcard SSL with Let's Encrypt,you likely have a well-known list of domains you're renewing for. The zone IDs don't change, and can be obtained from the dashboard, so you can avoid zones.browse if necessary.
True, but that's just not how general purpose ACME applications work like.
Taking greenlock as an example (since we're talking about node.js after all), it has a common interface for DNS plugins, whereby it gives them the targeted domain name, and what to do with it (set a record, read a record). Anything else specific to the DNS host (such as IDs) is up to the plugin to figure out from the provided DNS name. There are options when initializing the plugin, but that's set prior to knowing the domain names, applicable for all domains.
There's already a CloudFlare plugin for greenlock that does just that, and in fact, I was trying to patch it so that it supports tokens.
from node-cloudflare.
Then the jsdocs should probably be updated to reflect that, as there's nothing in them to hint this is possible.
PRs accepted. 😄
True, but that's just not how general purpose ACME applications work like.
Ok. I didn't have the context, and thought you were building something custom.
I'll consider this closed, since the ask has been answered.
from node-cloudflare.
Related Issues (20)
- Argo tunnel support HOT 5
- Improve error catching HOT 3
- GraphQL API support? HOT 1
- Old `got` breaks runtime HOT 6
- DNSRecords Scan is not supported
- Docs incorrect for Add PageRules
- Security Vulnerability: CVE-2022-33987 - got dependency HOT 10
- DeprecationWarning: OutgoingMessage.prototype._headers is deprecated HOT 7
- require('cloudflare') is not a function HOT 1
- domain registration support HOT 1
- Purge cache : Bad Request with lib, works with curl HOT 1
- Support deleting a worker script using the `accounts` api.
- Complete support for stream APIs
- Auth returns empty Object and no errors
- Please publish 2.8.0 HOT 3
- SSL Endpoints should be added
- Please add support for pages HOT 5
- Deprecated workers/filters for Zone Worker Routes HOT 2
- cf.zoneSettings.editAll not works as excepted HOT 2
- 403 error HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-cloudflare.