aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/backend/s3_backend/s3_backend.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-01-29 09:09:55 -0800
committerChris Lu <chris.lu@gmail.com>2020-01-29 09:09:55 -0800
commitd335f04de6861b571190c13bd7d65e9a0c02f187 (patch)
treead534357d50c4027718a7fe2e60391b6545a7db0 /weed/storage/backend/s3_backend/s3_backend.go
parent27b94cb65b34c084790f0a1884956702ee51acc2 (diff)
downloadseaweedfs-d335f04de6861b571190c13bd7d65e9a0c02f187.tar.xz
seaweedfs-d335f04de6861b571190c13bd7d65e9a0c02f187.zip
support env variables to overwrite toml file
Diffstat (limited to 'weed/storage/backend/s3_backend/s3_backend.go')
-rw-r--r--weed/storage/backend/s3_backend/s3_backend.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/weed/storage/backend/s3_backend/s3_backend.go b/weed/storage/backend/s3_backend/s3_backend.go
index 9f03cfa81..8d71861c2 100644
--- a/weed/storage/backend/s3_backend/s3_backend.go
+++ b/weed/storage/backend/s3_backend/s3_backend.go
@@ -26,8 +26,8 @@ type S3BackendFactory struct {
func (factory *S3BackendFactory) StorageType() backend.StorageType {
return backend.StorageType("s3")
}
-func (factory *S3BackendFactory) BuildStorage(configuration backend.StringProperties, id string) (backend.BackendStorage, error) {
- return newS3BackendStorage(configuration, id)
+func (factory *S3BackendFactory) BuildStorage(configuration backend.StringProperties, configPrefix string, id string) (backend.BackendStorage, error) {
+ return newS3BackendStorage(configuration, configPrefix, id)
}
type S3BackendStorage struct {
@@ -39,13 +39,13 @@ type S3BackendStorage struct {
conn s3iface.S3API
}
-func newS3BackendStorage(configuration backend.StringProperties, id string) (s *S3BackendStorage, err error) {
+func newS3BackendStorage(configuration backend.StringProperties, configPrefix string, id string) (s *S3BackendStorage, err error) {
s = &S3BackendStorage{}
s.id = id
- s.aws_access_key_id = configuration.GetString("aws_access_key_id")
- s.aws_secret_access_key = configuration.GetString("aws_secret_access_key")
- s.region = configuration.GetString("region")
- s.bucket = configuration.GetString("bucket")
+ s.aws_access_key_id = configuration.GetString(configPrefix + "aws_access_key_id")
+ s.aws_secret_access_key = configuration.GetString(configPrefix + "aws_secret_access_key")
+ s.region = configuration.GetString(configPrefix + "region")
+ s.bucket = configuration.GetString(configPrefix + "bucket")
s.conn, err = createSession(s.aws_access_key_id, s.aws_secret_access_key, s.region)
glog.V(0).Infof("created backend storage s3.%s for region %s bucket %s", s.id, s.region, s.bucket)