66 lines
1.7 KiB
Go
66 lines
1.7 KiB
Go
package ddb
|
|
|
|
import "github.com/tomas-qstarrs/boost/config"
|
|
|
|
type Table struct {
|
|
TableName string
|
|
IndexName string
|
|
PartitionKey string
|
|
SortKey string
|
|
SortKeyNum string
|
|
}
|
|
|
|
type Provisioned struct {
|
|
ReadCapacityUnits int64
|
|
WriteCapacityUnits int64
|
|
}
|
|
|
|
type Endpoint struct {
|
|
PartitionID string
|
|
URL string
|
|
SigningRegion string
|
|
}
|
|
|
|
type Credentials struct {
|
|
AccessKeyID string
|
|
SecretAccessKey string
|
|
SessionToken string
|
|
Source string
|
|
}
|
|
|
|
type Config struct {
|
|
Table Table
|
|
Provisioned Provisioned
|
|
Endpoint Endpoint
|
|
Credentials Credentials
|
|
TransactionSize int
|
|
}
|
|
|
|
func NewConfig() *Config {
|
|
return &Config{
|
|
Table: Table{
|
|
TableName: config.GetString("ddb.table.tableName"),
|
|
IndexName: config.GetString("ddb.table.indexName"),
|
|
PartitionKey: config.GetString("ddb.table.partitionKey"),
|
|
SortKey: config.GetString("ddb.table.sortKey"),
|
|
SortKeyNum: config.GetString("ddb.table.sortKeyNum"),
|
|
},
|
|
Provisioned: Provisioned{
|
|
ReadCapacityUnits: config.GetInt64("ddb.provisioned.readCapacityUnits"),
|
|
WriteCapacityUnits: config.GetInt64("ddb.provisioned.writeCapacityUnits"),
|
|
},
|
|
Endpoint: Endpoint{
|
|
PartitionID: config.GetString("ddb.endpoint.partitionID"),
|
|
URL: config.GetString("ddb.endpoint.url"),
|
|
SigningRegion: config.GetString("ddb.endpoint.signingRegion"),
|
|
},
|
|
Credentials: Credentials{
|
|
AccessKeyID: config.GetString("ddb.credentials.accessKeyID"),
|
|
SecretAccessKey: config.GetString("ddb.credentials.secretAccessKey"),
|
|
SessionToken: config.GetString("ddb.credentials.sessionToken"),
|
|
Source: config.GetString("ddb.credentials.source"),
|
|
},
|
|
TransactionSize: config.GetInt("ddb.transactionSize"),
|
|
}
|
|
}
|