Add the secure access with HTTPS

Signed-off-by: Li Yi <denverdino@gmail.com>
This commit is contained in:
Li Yi 2015-05-12 11:56:00 +08:00 committed by tgic
parent b8a276f2db
commit c3b42db014
2 changed files with 13 additions and 7 deletions

View File

@ -1,10 +1,10 @@
<!--GITHUB <!--GITHUB
page_title: OSS storage driver page_title: Aliyun OSS storage driver
page_description: Explains how to use the OSS storage drivers page_description: Explains how to use the Aliyun OSS storage drivers
page_keywords: registry, service, driver, images, storage, OSS page_keywords: registry, service, driver, images, storage, OSS, aliyun
IGNORES--> IGNORES-->
# OSS storage driver # Aliyun OSS storage driver
An implementation of the `storagedriver.StorageDriver` interface which uses Aliyun OSS for object storage. 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. `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). `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. `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). `rootdirectory`: (optional) The root directory tree in which all registry files will be stored. Defaults to the empty string (bucket root).

View File

@ -125,7 +125,7 @@ func FromParameters(parameters map[string]interface{}) (*Driver, error) {
if ok { if ok {
internalBool, ok = internal.(bool) internalBool, ok = internal.(bool)
if !ok { 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 // bucketName
func New(params DriverParameters) (*Driver, error) { 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) bucket := client.Bucket(params.Bucket)
// Validate that the given credentials have at least read permissions in the // Validate that the given credentials have at least read permissions in the