Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit 09d0605

Browse files
Tugzridanijel
authored andcommitted
Clarify token use with env variables and config files (#2)
1 parent c4f9107 commit 09d0605

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,13 @@ import CloudFlare
198198

199199
If the account email and API key are not passed when you create the class, then they are retrieved from either the users exported shell environment variables or the .cloudflare.cfg or ~/.cloudflare.cfg or ~/.cloudflare/cloudflare.cfg files, in that order.
200200

201+
If you're using an API Token, any `cloudflare.cfg` file must not contain an `email` attribute and the `CF_API_EMAIL` environment variable must be unset, otherwise the token will be treated as a key and will throw an error.
202+
201203
There is one call that presently doesn't need any email or token certification (the */ips* call); hence you can test without any values saved away.
202204

203205
### Using shell environment variables
204206
```bash
205-
$ export CF_API_EMAIL='user@example.com'
207+
$ export CF_API_EMAIL='user@example.com' # Do not set if using an API Token
206208
$ export CF_API_KEY='00000000000000000000000000000000'
207209
$ export CF_API_CERTKEY='v1.0-...'
208210
$
@@ -215,7 +217,7 @@ These are optional environment variables; however, they do override the values s
215217
```bash
216218
$ cat ~/.cloudflare/cloudflare.cfg
217219
[CloudFlare]
218-
email = user@example.com
220+
email = user@example.com # Do not set if using an API Token
219221
token = 00000000000000000000000000000000
220222
certtoken = v1.0-...
221223
extras =

README.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ class, then they are retrieved from either the users exported shell
225225
environment variables or the .cloudflare.cfg or ~/.cloudflare.cfg or
226226
~/.cloudflare/cloudflare.cfg files, in that order.
227227

228+
If you're using an API Token, any ``cloudflare.cfg`` file must not
229+
contain an ``email`` attribute and the ``CF_API_EMAIL`` environment
230+
variable must be unset, otherwise the token will be treated as a key
231+
and will throw an error.
232+
228233
There is one call that presently doesn't need any email or token
229234
certification (the */ips* call); hence you can test without any values
230235
saved away.
@@ -234,7 +239,7 @@ Using shell environment variables
234239

235240
.. code:: bash
236241
237-
$ export CF_API_EMAIL='user@example.com'
242+
$ export CF_API_EMAIL='user@example.com' # Do not set if using an API Token
238243
$ export CF_API_KEY='00000000000000000000000000000000'
239244
$ export CF_API_CERTKEY='v1.0-...'
240245
$
@@ -249,7 +254,7 @@ Using configuration file to store email and keys
249254
250255
$ cat ~/.cloudflare/cloudflare.cfg
251256
[CloudFlare]
252-
email = user@example.com
257+
email = user@example.com # Do not set if using an API Token
253258
token = 00000000000000000000000000000000
254259
certtoken = v1.0-...
255260
extras =

0 commit comments

Comments
 (0)