Skip to content

Commit

Permalink
config file processing was messed up
Browse files Browse the repository at this point in the history
  • Loading branch information
mahtin committed Mar 30, 2022
1 parent 456ab7f commit 2c4ee60
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 deletions CloudFlare/cloudflare.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,17 @@ def __init__(self, config):
self.network = CFnetwork(use_sessions=self.use_sessions)
self.user_agent = user_agent()

if not isinstance(self.email, str):
raise ValueError('email argument not string')
if not isinstance(self.token, str):
raise ValueError('token argument not string')
if not isinstance(self.certtoken, str):
raise ValueError('certtoken argument not string')
if not isinstance(self.base_url, str):
raise ValueError('base url argument not string')
## We don't need to check this here as we test for
## this when building the authentication headers
##
##if not isinstance(self.email, str):
## raise ValueError('email argument not string')
##if not isinstance(self.token, str):
## raise ValueError('token argument not string')
##if not isinstance(self.certtoken, str):
## raise ValueError('certtoken argument not string')
##if not isinstance(self.base_url, str):
## raise ValueError('base url argument not string')

if 'debug' in config and config['debug']:
self.logger = CFlogger(config['debug']).getLogger()
Expand Down
2 changes: 1 addition & 1 deletion CloudFlare/read_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def read_configs(profile=None):
# envioronment variables override config files - so setup first
config['email'] = os.getenv('CLOUDFLARE_EMAIL') if os.getenv('CLOUDFLARE_EMAIL') != None else os.getenv('CF_API_EMAIL')
config['token'] = os.getenv('CLOUDFLARE_API_KEY') if os.getenv('CLOUDFLARE_API_KEY') != None else os.getenv('CF_API_KEY')
config['certtoken'] = os.getenv('CLOUDFLARE_API_CERTKEY') if os.getenv('CLOUDFLARE_API_CERTKEY') != None else os.getenv('CF_API_CERTKEY')
config['certtoken'] = os.getenv('CLOUDFLARE_API_CERTKEY') if os.getenv('CLOUDFLARE_API_CERTKEY') != None else os.getenv('CF_API_CERTKEY')
config['extras'] = os.getenv('CLOUDFLARE_API_EXTRAS') if os.getenv('CLOUDFLARE_API_EXTRAS') != None else os.getenv('CF_API_EXTRAS')
config['base_url'] = os.getenv('CLOUDFLARE_API_URL') if os.getenv('CLOUDFLARE_API_URL') != None else os.getenv('CF_API_URL')
if profile is None:
Expand Down

0 comments on commit 2c4ee60

Please sign in to comment.