From c3b42db014afe2c90dc15053547fe69191c12805 Mon Sep 17 00:00:00 2001 From: Li Yi Date: Tue, 12 May 2015 11:56:00 +0800 Subject: [PATCH] Add the secure access with HTTPS Signed-off-by: Li Yi --- docs/storage-drivers/oss.md | 16 +++++++++++----- registry/storage/driver/oss/oss.go | 4 ++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/storage-drivers/oss.md b/docs/storage-drivers/oss.md index a8acd2775..997490156 100755 --- a/docs/storage-drivers/oss.md +++ b/docs/storage-drivers/oss.md @@ -1,10 +1,10 @@ -# OSS storage driver +# Aliyun OSS storage driver An implementation of the `storagedriver.StorageDriver` interface which uses Aliyun OSS for object storage. @@ -14,10 +14,16 @@ An implementation of the `storagedriver.StorageDriver` interface which uses Aliy `accesskeysecret`: Your access key secret. -`region`: The name of the aws region in which you would like to store objects (for example `oss-cn-beijing`). For a list of regions, you can look at http://docs.aliyun.com/?spm=5176.383663.9.2.0JzTP8#/oss/product-documentation/domain-region +`region`: The name of the OSS region in which you would like to store objects (for example `oss-cn-beijing`). For a list of regions, you can look at [http://docs.aliyun.com/?spm=5176.383663.9.2.0JzTP8#/oss/product-documentation/domain-region](http://docs.aliyun.com/?spm=5176.383663.9.2.0JzTP8#/oss/product-documentation/domain-region) + +`internal`: (optional) Using internal endpoint or the public endpoint for OSS access. The default is false. For a list of regions, you can look at [http://docs.aliyun.com/?spm=5176.383663.9.2.0JzTP8#/oss/product-documentation/domain-region](http://docs.aliyun.com/?spm=5176.383663.9.2.0JzTP8#/oss/product-documentation/domain-region) `bucket`: The name of your OSS bucket where you wish to store objects (needs to already be created prior to driver initialization). +`encrypt`: (optional) Whether you would like your data encrypted on the server side (defaults to false if not specified). + +`secure`: (optional) Whether you would like to transfer data to the bucket over ssl or not. Defaults to false if not specified. + `chunksize`: (optional) The default part size for multipart uploads (performed by WriteStream) to OSS. The default is 10 MB. Keep in mind that the minimum part size for OSS is 5MB. You might experience better performance for larger chunk sizes depending on the speed of your connection to OSS. `rootdirectory`: (optional) The root directory tree in which all registry files will be stored. Defaults to the empty string (bucket root). diff --git a/registry/storage/driver/oss/oss.go b/registry/storage/driver/oss/oss.go index 598bc55cd..9c52d5773 100755 --- a/registry/storage/driver/oss/oss.go +++ b/registry/storage/driver/oss/oss.go @@ -125,7 +125,7 @@ func FromParameters(parameters map[string]interface{}) (*Driver, error) { if ok { internalBool, ok = internal.(bool) if !ok { - return nil, fmt.Errorf("The encrypt parameter should be a boolean") + return nil, fmt.Errorf("The internal parameter should be a boolean") } } @@ -194,7 +194,7 @@ func FromParameters(parameters map[string]interface{}) (*Driver, error) { // bucketName func New(params DriverParameters) (*Driver, error) { - client := oss.NewOSSClient(params.Region, params.Internal, params.AccessKeyID, params.AccessKeySecret) + client := oss.NewOSSClient(params.Region, params.Internal, params.AccessKeyID, params.AccessKeySecret, params.Secure) bucket := client.Bucket(params.Bucket) // Validate that the given credentials have at least read permissions in the