Automatically resolve default KinesisEndpoint
This commit fixes #5 by returning `aws.EndpointNotFoundError` from the endpoint resolver when no `KinesisEndpoint` is defined, which will resolve the default AWS endpoint. This is the same process used by the DynamoDB checkpointer to resolve the default endpoint. Signed-off-by: Caleb Stewart <caleb.stewart94@gmail.com>
This commit is contained in:
parent
c862165130
commit
e2a45c53c3
1 changed files with 9 additions and 5 deletions
|
|
@ -160,11 +160,15 @@ func (w *Worker) initialize() error {
|
|||
log.Infof("Creating Kinesis client")
|
||||
|
||||
resolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) {
|
||||
return aws.Endpoint{
|
||||
PartitionID: "aws",
|
||||
URL: w.kclConfig.KinesisEndpoint,
|
||||
SigningRegion: w.regionName,
|
||||
}, nil
|
||||
if service == kinesis.ServiceID && len(w.kclConfig.KinesisEndpoint) > 0 {
|
||||
return aws.Endpoint{
|
||||
PartitionID: "aws",
|
||||
URL: w.kclConfig.KinesisEndpoint,
|
||||
SigningRegion: w.regionName,
|
||||
}, nil
|
||||
}
|
||||
// returning EndpointNotFoundError will allow the service to fallback to it's default resolution
|
||||
return aws.Endpoint{}, &aws.EndpointNotFoundError{}
|
||||
})
|
||||
|
||||
cfg, err := awsConfig.LoadDefaultConfig(
|
||||
|
|
|
|||
Loading…
Reference in a new issue