Skip to content

Commit

Permalink
Merge pull request #15 from eternalharvest/hotfix/env_vars
Browse files Browse the repository at this point in the history
support environmental variable
  • Loading branch information
eternalharvest authored May 31, 2017
2 parents 9df1f36 + 20fc529 commit 35da366
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions r53update/r53update.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,18 @@ class R53UpdateApp(App):
##
# Context
class Context(object):
def __init__(self, profile=''):
def __init__(self, profile=None):
self.session = Session()
self.session.profile = profile

def getR53Connection(self):
credential = self.session.get_credentials()
if not credential:
raise RuntimeError("failed to get aws credential")

return Route53Connection(
self.session.get_scoped_config()['aws_access_key_id'],
self.session.get_scoped_config()['aws_secret_access_key']
credential.access_key,
credential.secret_key
)

##
Expand Down Expand Up @@ -218,7 +222,7 @@ def _pre_init(self):
self._gipmethods['localhost'] = R53UpdateApp.NETIFACES_GlobalIP_DetectionMethod(self)

# optional argument
self._parser.add_argument('--profile', type=str, metavar='PROFILE', default='',
self._parser.add_argument('--profile', type=str, metavar='PROFILE', default=None,
help='name of a profile to use, or "default" to use the default profile').completer = R53UpdateApp.ProfileCompleter(self)
self._parser.add_argument('--method', type=str, metavar='METHOD',
default='opendns.com', help='detection method of global IP').completer = R53UpdateApp.MethodCompleter(self)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

setup(
name = 'r53update',
version='0.5.1',
version='0.5.2',
description='R53Update Dynamic DNS Updater',
author='Takuya Sawada',
author_email='[email protected]',
Expand Down

0 comments on commit 35da366

Please sign in to comment.