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

Commit cbeee2c

Browse files
committed
#136 pointed out that the config file profile name has a capital F in it. Now it takes lower case "f" value
1 parent da1645c commit cbeee2c

3 files changed

Lines changed: 21 additions & 7 deletions

File tree

CloudFlare/read_configs.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ def read_configs(profile=None):
1919
config['certtoken'] = os.getenv('CLOUDFLARE_API_CERTKEY') if os.getenv('CLOUDFLARE_API_CERTKEY') != None else os.getenv('CF_API_CERTKEY')
2020
config['extras'] = os.getenv('CLOUDFLARE_API_EXTRAS') if os.getenv('CLOUDFLARE_API_EXTRAS') != None else os.getenv('CF_API_EXTRAS')
2121
config['base_url'] = os.getenv('CLOUDFLARE_API_URL') if os.getenv('CLOUDFLARE_API_URL') != None else os.getenv('CF_API_URL')
22-
if profile is None:
23-
profile = 'CloudFlare'
24-
config['profile'] = profile
2522

2623
# grab values from config files
2724
cp = configparser.ConfigParser()
@@ -34,6 +31,19 @@ def read_configs(profile=None):
3431
except Exception as e:
3532
raise Exception("%s: configuration file error" % (profile))
3633

34+
# Is it CloudFlare or Cloudflare? (A legacy issue)
35+
if profile is None:
36+
if len(cp.sections()) > 0:
37+
if 'CloudFlare' in cp:
38+
profile = 'CloudFlare'
39+
if 'Cloudflare' in cp:
40+
profile = 'Cloudflare'
41+
42+
## still not found - then set to to CloudFlare for legacy reasons
43+
if profile == None:
44+
profile = "CloudFlare"
45+
config['profile'] = profile
46+
3747
if len(cp.sections()) > 0:
3848
# we have a configuration file - lets use it
3949
try:

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,11 @@ These are optional environment variables; however, they do override the values s
233233

234234
### Using configuration file to store email and keys
235235

236+
The default profile name is `Cloudflare` for obvious reasons.
237+
236238
```bash
237239
$ cat ~/.cloudflare/cloudflare.cfg
238-
[CloudFlare]
240+
[Cloudflare]
239241
email = user@example.com # Do not set if using an API Token
240242
token = 00000000000000000000000000000000
241243
certtoken = v1.0-...
@@ -1127,7 +1129,7 @@ An automatically generated table of commands is provided [here](TABLE-OF-COMMAND
11271129
Extra API calls can be added via the configuration file
11281130
```bash
11291131
$ cat ~/.cloudflare/cloudflare.cfg
1130-
[CloudFlare]
1132+
[Cloudflare]
11311133
extras =
11321134
/client/v4/command
11331135
/client/v4/command/:command_identifier

README.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,12 @@ These are optional environment variables; however, they do override the values s
239239
Using configuration file to store email and keys
240240
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
241241

242+
The default profile name is ``Cloudflare`` for obvious reasons.
243+
242244
.. code:: bash
243245
244246
$ cat ~/.cloudflare/cloudflare.cfg
245-
[CloudFlare]
247+
[Cloudflare]
246248
email = user@example.com # Do not set if using an API Token
247249
token = 00000000000000000000000000000000
248250
certtoken = v1.0-...
@@ -1143,7 +1145,7 @@ Extra API calls can be added via the configuration file
11431145
.. code:: bash
11441146
11451147
$ cat ~/.cloudflare/cloudflare.cfg
1146-
[CloudFlare]
1148+
[Cloudflare]
11471149
extras =
11481150
/client/v4/command
11491151
/client/v4/command/:command_identifier

0 commit comments

Comments
 (0)