mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 19:47:54 +00:00
Allow configuration of dynamodb storage to specify the max retries of aws sdk (#4115)
This commit is contained in:
committed by
Jeff Mitchell
parent
ba1eb65df1
commit
af974c2112
@@ -183,6 +183,19 @@ func NewDynamoDBBackend(conf map[string]string, logger log.Logger) (physical.Bac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dynamodbMaxRetryString := os.Getenv("AWS_DYNAMODB_MAX_RETRIES")
|
||||||
|
if dynamodbMaxRetryString == "" {
|
||||||
|
dynamodbMaxRetryString = conf["dynamodb_max_retries"]
|
||||||
|
}
|
||||||
|
var dynamodbMaxRetry int = aws.UseServiceDefaultRetries
|
||||||
|
if dynamodbMaxRetryString != "" {
|
||||||
|
var err error
|
||||||
|
dynamodbMaxRetry, err = strconv.Atoi(dynamodbMaxRetryString)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("invalid max retry: %s", dynamodbMaxRetryString)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
credsConfig := &awsutil.CredentialsConfig{
|
credsConfig := &awsutil.CredentialsConfig{
|
||||||
AccessKey: accessKey,
|
AccessKey: accessKey,
|
||||||
SecretKey: secretKey,
|
SecretKey: secretKey,
|
||||||
@@ -202,7 +215,8 @@ func NewDynamoDBBackend(conf map[string]string, logger log.Logger) (physical.Bac
|
|||||||
WithEndpoint(endpoint).
|
WithEndpoint(endpoint).
|
||||||
WithHTTPClient(&http.Client{
|
WithHTTPClient(&http.Client{
|
||||||
Transport: pooledTransport,
|
Transport: pooledTransport,
|
||||||
})
|
}).
|
||||||
|
WithMaxRetries(dynamodbMaxRetry)
|
||||||
client := dynamodb.New(session.New(awsConf))
|
client := dynamodb.New(session.New(awsConf))
|
||||||
|
|
||||||
if err := ensureTableExists(client, table, readCapacity, writeCapacity); err != nil {
|
if err := ensureTableExists(client, table, readCapacity, writeCapacity); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user