Skip to content

Commit

Permalink
allow specifying an endpoint_url override
Browse files Browse the repository at this point in the history
  • Loading branch information
doy-stripe committed Aug 17, 2017
1 parent 03ca865 commit 3c25703
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
14 changes: 10 additions & 4 deletions confidant_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def __init__(
retries=None,
backoff=None,
config_files=None,
profile=None
profile=None,
kms_endpoint_url=None
):
"""Create a ConfidantClient object.
Expand Down Expand Up @@ -78,6 +79,8 @@ def __init__(
configuration from. First file found will be used. Default:
['~/.confidant', '/etc/confidant/config']
profile: profile to read config values from.
kms_endpoint_url: A URL to override the default endpoint used to
access the KMS service. Default: None
"""
# Set defaults
self.config = {
Expand All @@ -90,7 +93,8 @@ def __init__(
'assume_role': None,
'region': None,
'retries': 0,
'backoff': 1
'backoff': 1,
'kms_endpoint_url': None
}
if config_files is None:
config_files = ['~/.confidant', '/etc/confidant/config']
Expand All @@ -108,7 +112,8 @@ def __init__(
'token_cache_file': token_cache_file,
'region': region,
'backoff': backoff,
'assume_role': assume_role
'assume_role': assume_role,
'kms_endpoint_url': kms_endpoint_url
}
for key, val in args_config.iteritems():
if val is not None:
Expand Down Expand Up @@ -157,7 +162,8 @@ def __init__(
token_version=self.config['token_version'],
token_cache_file=self.config['token_cache_file'],
token_lifetime=self.config['token_lifetime'],
aws_creds=self.aws_creds
aws_creds=self.aws_creds,
endpoint_url=self.config['kms_endpoint_url']
)
except kmsauth.ConfigurationError:
raise ClientConfigurationError('Error configuring kmsauth client.')
Expand Down
7 changes: 6 additions & 1 deletion confidant_client/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def _get_client_from_args(args):
region=args.region,
retries=args.retries,
config_files=config_files,
profile=args.profile
profile=args.profile,
kms_endpoint_url=args.kms_endpoint_url
)
return client

Expand Down Expand Up @@ -133,6 +134,10 @@ def _parse_args():
'--region',
help='Use the specified region for authentication.'
)
parser.add_argument(
'--kms-endpoint-url',
help='Use a different endpoint url for the KMS service.'
)
parser.add_argument(
'--log-level',
help='Logging verbosity.',
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
# Licence: Apache2
# Upstream url: https://github.com/lyft/python-kmsauth
# Use: client authentication to confidant
'kmsauth>=0.1.6,<1.0.0',
'kmsauth>=0.2.0,<1.0.0',

# Provides enhanced HTTPS support for httplib and urllib2 using PyOpenSSL
# License: BSD
Expand Down

0 comments on commit 3c25703

Please sign in to comment.