forked from cloudflare/python-cloudflare
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clarify token use with env variables and config files (cloudflare#2)
- Loading branch information
Showing
2 changed files
with
11 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,11 +198,13 @@ import CloudFlare | |
|
||
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. | ||
|
||
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. | ||
|
||
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. | ||
|
||
### Using shell environment variables | ||
```bash | ||
$ export CF_API_EMAIL='[email protected]' | ||
$ export CF_API_EMAIL='[email protected]' # Do not set if using an API Token | ||
$ export CF_API_KEY='00000000000000000000000000000000' | ||
$ export CF_API_CERTKEY='v1.0-...' | ||
$ | ||
|
@@ -215,7 +217,7 @@ These are optional environment variables; however, they do override the values s | |
```bash | ||
$ cat ~/.cloudflare/cloudflare.cfg | ||
[CloudFlare] | ||
email = [email protected] | ||
email = [email protected] # Do not set if using an API Token | ||
token = 00000000000000000000000000000000 | ||
certtoken = v1.0-... | ||
extras = | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,6 +225,11 @@ 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. | ||
|
||
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. | ||
|
||
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. | ||
|
@@ -234,7 +239,7 @@ Using shell environment variables | |
|
||
.. code:: bash | ||
$ export CF_API_EMAIL='[email protected]' | ||
$ export CF_API_EMAIL='[email protected]' # Do not set if using an API Token | ||
$ export CF_API_KEY='00000000000000000000000000000000' | ||
$ export CF_API_CERTKEY='v1.0-...' | ||
$ | ||
|
@@ -249,7 +254,7 @@ Using configuration file to store email and keys | |
$ cat ~/.cloudflare/cloudflare.cfg | ||
[CloudFlare] | ||
email = [email protected] | ||
email = [email protected] # Do not set if using an API Token | ||
token = 00000000000000000000000000000000 | ||
certtoken = v1.0-... | ||
extras = | ||
|