From 1abf045b302d26ac36b5c230e09c88a2c8eaba38 Mon Sep 17 00:00:00 2001 From: Ken Perkins Date: Fri, 28 Feb 2014 13:10:03 -0800 Subject: [PATCH] Add the ability to have storage client set alternate serviceType - Fixes #258 --- lib/pkgcloud/openstack/storage/storageClient.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/pkgcloud/openstack/storage/storageClient.js b/lib/pkgcloud/openstack/storage/storageClient.js index 221c82cf0..22373fea1 100644 --- a/lib/pkgcloud/openstack/storage/storageClient.js +++ b/lib/pkgcloud/openstack/storage/storageClient.js @@ -42,11 +42,17 @@ Client.prototype._getUrl = function (options) { fragment = urlJoin(fragment, options.path.split('/').map(encodeURIComponent).join('/')); } + var serviceUrl = options.serviceType ? this._identity.getServiceEndpointUrl({ + serviceType: options.serviceType, + region: this.region + }) : this._serviceUrl; + if (fragment === '' || fragment === '/') { - return this._serviceUrl; + return serviceUrl; } - return urlJoin(this._serviceUrl, fragment); + return urlJoin(serviceUrl, fragment); + }; Client.prototype.serializeMetadata = function (prefix, metadata) {