Comparing version 0.7.8 to 0.7.9
@@ -1,2 +0,8 @@ | ||
2013.0.13 Version 0.7.8 | ||
2013.06.19 Version 0.7.9 | ||
* First part of new SDK configuration system | ||
* Support for AZURE_SERVICEBUS_CONNECTION_STRING environment variable | ||
* Updated SAS generation logic to include version number | ||
* Infrastructure support for creating passwordless VMs | ||
2013.06.13 Version 0.7.8 | ||
* Updates to HDInsight operations | ||
@@ -3,0 +9,0 @@ |
@@ -95,3 +95,3 @@ /** | ||
* | ||
* @param {string} [namespaceOrConnectionString] The service bus namespace. | ||
* @param {string} [configOrNamespaceOrConnectionString] The service bus namespace or other config information. | ||
* @param {string} [accessKey] The password. | ||
@@ -103,4 +103,4 @@ * @param {string} [issuer] The issuer. | ||
*/ | ||
exports.createServiceBusService = function (namespaceOrConnectionString, accessKey, issuer, acsNamespace, host, authenticationProvider) { | ||
return new ServiceBusService(namespaceOrConnectionString, accessKey, issuer, acsNamespace, host, authenticationProvider); | ||
exports.createServiceBusService = function (configOrNamespaceOrConnectionString, accessKey, issuer, acsNamespace, host, authenticationProvider) { | ||
return new ServiceBusService(configOrNamespaceOrConnectionString, accessKey, issuer, acsNamespace, host, authenticationProvider); | ||
}; | ||
@@ -276,2 +276,3 @@ | ||
exports.Constants = require('./util/constants'); | ||
exports.ServiceClientConstants = require('./services/core/serviceclientconstants'); | ||
exports.LinearRetryPolicyFilter = require('./services/core/linearretrypolicyfilter'); | ||
@@ -301,1 +302,22 @@ exports.ExponentialRetryPolicyFilter = require('./services/core/exponentialretrypolicyfilter'); | ||
}; | ||
/* | ||
* Configuration | ||
*/ | ||
var sdkconfig = require('./util/sdkconfig'); | ||
exports.config = sdkconfig; | ||
exports.configure = function (env, configCallback) { | ||
sdkconfig.configure(env, configCallback); | ||
}; | ||
exports.dumpConfig = function () { | ||
console.log(); | ||
sdkconfig.environments.forEach(function (e) { | ||
console.log('Environment', e); | ||
var env = sdkconfig(e); | ||
env.settings.forEach(function (setting) { | ||
console.log(' ', setting, ':', env.get(setting)); | ||
}); | ||
}); | ||
}; |
@@ -26,2 +26,5 @@ /** | ||
var SAS_VERSION = '2012-02-12'; | ||
/** | ||
@@ -76,2 +79,4 @@ * Creates a new SharedAccessSignature object. | ||
queryString[QueryStringConstants.SIGNED_VERSION] = SAS_VERSION; | ||
queryString[QueryStringConstants.SIGNATURE] = this._generateSignature(path, resourceType, sharedAccessPolicy); | ||
@@ -155,3 +160,4 @@ | ||
getvalueToAppend(canonicalizedResource) + | ||
getvalueToAppend(sharedAccessPolicy.Id, true); | ||
getvalueToAppend(sharedAccessPolicy.Id) + | ||
SAS_VERSION; | ||
@@ -158,0 +164,0 @@ return this.signer.sign(stringToSign); |
@@ -16,4 +16,6 @@ /** | ||
var _ = require('underscore'); | ||
var url = require('url'); | ||
var nodeutil = require('util'); | ||
var azure = require('../../azure'); | ||
var util = require('../../util/util'); | ||
@@ -24,2 +26,4 @@ | ||
var ConnectionStringKeys = Constants.ConnectionStringKeys; | ||
var ServiceClientConstants = require('./serviceclientconstants'); | ||
var EnvironmentVariables = ServiceClientConstants.EnvironmentVariables; | ||
var Validate = require('../../util/validate'); | ||
@@ -174,2 +178,119 @@ | ||
module.exports = ServiceBusSettings; | ||
/* | ||
* Code that deals with the sdk configuration object | ||
*/ | ||
// Keys used to look up values in configuration | ||
var configKeys = { | ||
CONNECTION_STRING: 'service bus connection string' | ||
}; | ||
// Check if the old environment variables are set | ||
function separateEnvironmentVariablesSet() { | ||
var varsToFind = [EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE, | ||
EnvironmentVariables.AZURE_SERVICEBUS_ACCESS_KEY]; | ||
return varsToFind.every(function (v) { return !!process.env[v]; }); | ||
} | ||
// Create settings from the environment variables | ||
function createSettingsFromEnvironment() { | ||
var namespace = process.env[EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE]; | ||
var hostname = namespace + '.' + ServiceClientConstants.CLOUD_SERVICEBUS_HOST; | ||
var issuer = process.env[EnvironmentVariables.AZURE_SERVICEBUS_ISSUER]; | ||
if (!issuer) { | ||
issuer = ServiceClientConstants.DEFAULT_SERVICEBUS_ISSUER; | ||
} | ||
var accessKey = process.env[EnvironmentVariables.AZURE_SERVICEBUS_ACCESS_KEY]; | ||
var acsNamespace = process.env[EnvironmentVariables.AZURE_SERVICEBUS_WRAP_NAMESPACE]; | ||
if (!acsNamespace) { | ||
acsNamespace = namespace + ServiceClientConstants.DEFAULT_WRAP_NAMESPACE_SUFFIX; | ||
} | ||
var acshostname = acsNamespace + '.' + ServiceClientConstants.CLOUD_ACCESS_CONTROL_HOST; | ||
var endpoint = url.format({ protocol: 'https', port: 443, hostname: hostname }); | ||
var stsendpoint = url.format({ | ||
protocol: 'https', | ||
port: 443, | ||
hostname: acshostname, | ||
pathname: 'WRAPv0.9' | ||
}); | ||
return { | ||
endpoint: endpoint, | ||
sharedsecretissuer: issuer, | ||
sharedsecretvalue: accessKey, | ||
stsendpoint: stsendpoint | ||
}; | ||
} | ||
/** | ||
* Create a ServiceBusSettings object from the given configuration | ||
* | ||
* @param {object} config the configuration object to use, if not given will | ||
* use azure.config.default | ||
* | ||
* @return {ServiceBusSettings} | ||
*/ | ||
ServiceBusSettings.createFromConfig = function (config) { | ||
if (!config) { | ||
config = azure.config.default; | ||
} | ||
var connectionString; | ||
if (config.has(configKeys.CONNECTION_STRING)) { | ||
connectionString = config.get(configKeys.CONNECTION_STRING); | ||
} else if (process.env[EnvironmentVariables.AZURE_SERVICEBUS_CONNECTION_STRING]) { | ||
connectionString = process.env[EnvironmentVariables.AZURE_SERVICEBUS_CONNECTION_STRING]; | ||
} else if (separateEnvironmentVariablesSet()) { | ||
return ServiceBusSettings.createFromSettings(createSettingsFromEnvironment()); | ||
} | ||
if (connectionString) { | ||
return ServiceBusSettings.createFromConnectionString(connectionString); | ||
} | ||
throw new Error('Cannot find correct Service Bus settings in configuration or environment'); | ||
}; | ||
/** | ||
* Customize a config object with methods to configure service bus settings | ||
* | ||
* @param {config} config The configuration object to add to | ||
*/ | ||
ServiceBusSettings.customizeConfig = function (config) { | ||
function serviceBus(connectionStringOrOptions) { | ||
if (_.isString(connectionStringOrOptions)) { | ||
this.set(configKeys.CONNECTION_STRING, connectionStringOrOptions); | ||
} else { | ||
var namespace = connectionStringOrOptions.namespace; | ||
var host = connectionStringOrOptions.host || ServiceClientConstants.CLOUD_SERVICEBUS_HOST; | ||
var stshost = connectionStringOrOptions.acsHost || ServiceClientConstants.CLOUD_ACCESS_CONTROL_HOST; | ||
var acsNamespace = connectionStringOrOptions.wrapNamespace || | ||
namespace + ServiceClientConstants.DEFAULT_WRAP_NAMESPACE_SUFFIX; | ||
var hostname = namespace + '.' + host; | ||
var stshostname = acsNamespace + '.' + stshost; | ||
var issuer = connectionStringOrOptions.issuer || ServiceClientConstants.DEFAULT_SERVICEBUS_ISSUER; | ||
var key = connectionStringOrOptions.key; | ||
var parts = { | ||
Endpoint: 'sb://' + hostname + ':443', | ||
StsEndpoint: 'https://' + stshostname + ':443/WRAPv0.9', | ||
SharedSecretIssuer: issuer, | ||
SharedSecretValue: key | ||
}; | ||
var connectionString = nodeutil.format('Endpoint=%s;StsEndpoint=%s;SharedSecretIssuer=%s;SharedSecretValue=%s', | ||
parts.Endpoint, parts.StsEndpoint, parts.SharedSecretIssuer, parts.SharedSecretValue); | ||
this.set(configKeys.CONNECTION_STRING, connectionString); | ||
} | ||
} | ||
config.serviceBus = serviceBus; | ||
}; | ||
module.exports = ServiceBusSettings; |
@@ -28,2 +28,4 @@ /** | ||
var Constants = require('../../util/constants'); | ||
var ServiceClientConstants = require('./serviceclientconstants'); | ||
var HeaderConstants = Constants.HeaderConstants; | ||
@@ -82,63 +84,3 @@ var HttpResponseCodes = Constants.HttpConstants.HttpResponseCodes; | ||
/* | ||
* Used environment variables. | ||
* @enum {string} | ||
*/ | ||
ServiceClient.EnvironmentVariables = { | ||
AZURE_STORAGE_ACCOUNT: 'AZURE_STORAGE_ACCOUNT', | ||
AZURE_STORAGE_ACCESS_KEY: 'AZURE_STORAGE_ACCESS_KEY', | ||
AZURE_STORAGE_DNS_SUFFIX: 'AZURE_STORAGE_DNS_SUFFIX', | ||
AZURE_SERVICEBUS_NAMESPACE: 'AZURE_SERVICEBUS_NAMESPACE', | ||
AZURE_SERVICEBUS_ISSUER: 'AZURE_SERVICEBUS_ISSUER', | ||
AZURE_SERVICEBUS_ACCESS_KEY: 'AZURE_SERVICEBUS_ACCESS_KEY', | ||
AZURE_WRAP_NAMESPACE: 'AZURE_WRAP_NAMESPACE', | ||
HTTP_PROXY: 'HTTP_PROXY', | ||
HTTPS_PROXY: 'HTTPS_PROXY', | ||
EMULATED: 'EMULATED', | ||
AZURE_CERTFILE: 'AZURE_CERTFILE', | ||
AZURE_KEYFILE: 'AZURE_KEYFILE' | ||
}; | ||
/** | ||
* Default credentials. | ||
*/ | ||
ServiceClient.DEVSTORE_STORAGE_ACCOUNT = Constants.DEV_STORE_NAME; | ||
ServiceClient.DEVSTORE_STORAGE_ACCESS_KEY = Constants.DEV_STORE_KEY; | ||
/** | ||
* Development ServiceClient URLs. | ||
*/ | ||
ServiceClient.DEVSTORE_BLOB_HOST = Constants.DEV_STORE_BLOB_HOST; | ||
ServiceClient.DEVSTORE_QUEUE_HOST = Constants.DEV_STORE_QUEUE_HOST; | ||
ServiceClient.DEVSTORE_TABLE_HOST = Constants.DEV_STORE_TABLE_HOST; | ||
/** | ||
* Live ServiceClient URLs. | ||
*/ | ||
var storageDnsSuffix = process.env.AZURE_STORAGE_DNS_SUFFIX || 'core.windows.net'; | ||
ServiceClient.CLOUD_BLOB_HOST = 'blob.' + storageDnsSuffix; | ||
ServiceClient.CLOUD_QUEUE_HOST = 'queue.' + storageDnsSuffix; | ||
ServiceClient.CLOUD_TABLE_HOST = 'table.' + storageDnsSuffix; | ||
ServiceClient.CLOUD_SERVICEBUS_HOST = 'servicebus.windows.net'; | ||
ServiceClient.CLOUD_ACCESS_CONTROL_HOST = 'accesscontrol.windows.net'; | ||
ServiceClient.CLOUD_SERVICE_MANAGEMENT_HOST = 'management.core.windows.net'; | ||
ServiceClient.CLOUD_DATABASE_HOST = 'database.windows.net'; | ||
/** | ||
* The default service bus issuer. | ||
*/ | ||
ServiceClient.DEFAULT_SERVICEBUS_ISSUER = 'owner'; | ||
/** | ||
* The default wrap namespace suffix. | ||
*/ | ||
ServiceClient.DEFAULT_WRAP_NAMESPACE_SUFFIX = '-sb'; | ||
/** | ||
* The default protocol. | ||
*/ | ||
ServiceClient.DEFAULT_PROTOCOL = ServiceSettings.DEFAULT_PROTOCOL; | ||
/** | ||
* Sets a host for the service. | ||
@@ -445,10 +387,10 @@ * | ||
var proxyUrl = null; | ||
if (process.env[ServiceClient.EnvironmentVariables.HTTPS_PROXY]) { | ||
proxyUrl = process.env[ServiceClient.EnvironmentVariables.HTTPS_PROXY]; | ||
} else if (process.env[ServiceClient.EnvironmentVariables.HTTPS_PROXY.toLowerCase()]) { | ||
proxyUrl = process.env[ServiceClient.EnvironmentVariables.HTTPS_PROXY.toLowerCase()]; | ||
} else if (process.env[ServiceClient.EnvironmentVariables.HTTP_PROXY]) { | ||
proxyUrl = process.env[ServiceClient.EnvironmentVariables.HTTP_PROXY]; | ||
} else if (process.env[ServiceClient.EnvironmentVariables.HTTP_PROXY.toLowerCase()]) { | ||
proxyUrl = process.env[ServiceClient.EnvironmentVariables.HTTP_PROXY.toLowerCase()]; | ||
if (process.env[ServiceClientConstants.EnvironmentVariables.HTTPS_PROXY]) { | ||
proxyUrl = process.env[ServiceClientConstants.EnvironmentVariables.HTTPS_PROXY]; | ||
} else if (process.env[ServiceClientConstants.EnvironmentVariables.HTTPS_PROXY.toLowerCase()]) { | ||
proxyUrl = process.env[ServiceClientConstants.EnvironmentVariables.HTTPS_PROXY.toLowerCase()]; | ||
} else if (process.env[ServiceClientConstants.EnvironmentVariables.HTTP_PROXY]) { | ||
proxyUrl = process.env[ServiceClientConstants.EnvironmentVariables.HTTP_PROXY]; | ||
} else if (process.env[ServiceClientConstants.EnvironmentVariables.HTTP_PROXY.toLowerCase()]) { | ||
proxyUrl = process.env[ServiceClientConstants.EnvironmentVariables.HTTP_PROXY.toLowerCase()]; | ||
} | ||
@@ -641,4 +583,4 @@ | ||
ServiceClient.isEmulated = function () { | ||
return (!azureutil.objectIsNull(process.env[ServiceClient.EnvironmentVariables.EMULATED]) && | ||
process.env[ServiceClient.EnvironmentVariables.EMULATED] !== 'false'); | ||
return (!azureutil.objectIsNull(process.env[ServiceClientConstants.EnvironmentVariables.EMULATED]) && | ||
process.env[ServiceClientConstants.EnvironmentVariables.EMULATED] !== 'false'); | ||
}; | ||
@@ -645,0 +587,0 @@ |
@@ -24,2 +24,3 @@ /** | ||
var Constants = require('../../util/constants'); | ||
var ServiceClientConstants = require('./serviceclientconstants'); | ||
var HeaderConstants = Constants.HeaderConstants; | ||
@@ -84,3 +85,3 @@ | ||
if (this.keyvalue === null || this.keyvalue.length === 0) { | ||
var keyfile = process.env[ServiceClient.EnvironmentVariables.AZURE_KEYFILE]; | ||
var keyfile = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_KEYFILE]; | ||
if (typeof keyfile === 'string' && keyfile.length > 0) { | ||
@@ -92,3 +93,3 @@ this.keyvalue = fs.readFileSync(keyfile, 'ascii'); | ||
if (this.certvalue === null || this.certvalue.length === 0) { | ||
var certfile = process.env[ServiceClient.EnvironmentVariables.AZURE_CERTFILE]; | ||
var certfile = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_CERTFILE]; | ||
if (typeof certfile === 'string' && certfile.length > 0) { | ||
@@ -116,3 +117,3 @@ this.certvalue = fs.readFileSync(certfile, 'ascii'); | ||
ServiceManagementClient.prototype._setServiceHost = function (hostOptions) { | ||
this.host = ServiceClient.CLOUD_SERVICE_MANAGEMENT_HOST; | ||
this.host = ServiceClientConstants.CLOUD_SERVICE_MANAGEMENT_HOST; | ||
this.apiversion = ServiceManagementClient.DefaultAPIVersion; | ||
@@ -119,0 +120,0 @@ this.serializetype = ServiceManagementClient.DefaultSerializeType; |
@@ -27,2 +27,3 @@ /** | ||
var Constants = require('../../util/constants'); | ||
var ServiceClientConstants = require('./serviceclientconstants'); | ||
var HeaderConstants = Constants.HeaderConstants; | ||
@@ -99,13 +100,13 @@ var QueryStringConstants = Constants.QueryStringConstants; | ||
if (!storageAccount) { | ||
storageAccount = process.env[ServiceClient.EnvironmentVariables.AZURE_STORAGE_ACCOUNT]; | ||
storageAccount = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCOUNT]; | ||
} | ||
if (!storageAccessKey) { | ||
storageAccessKey = process.env[ServiceClient.EnvironmentVariables.AZURE_STORAGE_ACCESS_KEY]; | ||
storageAccessKey = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCESS_KEY]; | ||
} | ||
// Default endpoints | ||
var blobendpoint = url.format({ protocol: ServiceClient.DEFAULT_PROTOCOL, hostname: storageAccount + '.' + ServiceClient.CLOUD_BLOB_HOST }); | ||
var tableendpoint = url.format({ protocol: ServiceClient.DEFAULT_PROTOCOL, hostname: storageAccount + '.' + ServiceClient.CLOUD_TABLE_HOST }); | ||
var queueendpoint = url.format({ protocol: ServiceClient.DEFAULT_PROTOCOL, hostname: storageAccount + '.' + ServiceClient.CLOUD_QUEUE_HOST }); | ||
var blobendpoint = url.format({ protocol: ServiceClientConstants.DEFAULT_PROTOCOL, hostname: storageAccount + '.' + ServiceClientConstants.CLOUD_BLOB_HOST }); | ||
var tableendpoint = url.format({ protocol: ServiceClientConstants.DEFAULT_PROTOCOL, hostname: storageAccount + '.' + ServiceClientConstants.CLOUD_TABLE_HOST }); | ||
var queueendpoint = url.format({ protocol: ServiceClientConstants.DEFAULT_PROTOCOL, hostname: storageAccount + '.' + ServiceClientConstants.CLOUD_QUEUE_HOST }); | ||
@@ -251,6 +252,6 @@ if (host) { | ||
if (azureutil.objectIsNull(storageAccount)) { | ||
if (process.env[ServiceClient.EnvironmentVariables.AZURE_STORAGE_ACCOUNT]) { | ||
storageAccount = process.env[ServiceClient.EnvironmentVariables.AZURE_STORAGE_ACCOUNT]; | ||
if (process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCOUNT]) { | ||
storageAccount = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCOUNT]; | ||
} else if (ServiceClient.isEmulated()) { | ||
storageAccount = ServiceClient.DEVSTORE_STORAGE_ACCOUNT; | ||
storageAccount = ServiceClientConstants.DEVSTORE_STORAGE_ACCOUNT; | ||
} | ||
@@ -260,3 +261,3 @@ } | ||
if (azureutil.objectIsNull(storageAccessKey)) { | ||
if (process.env[ServiceClient.EnvironmentVariables.AZURE_STORAGE_ACCESS_KEY]) { | ||
if (process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCESS_KEY]) { | ||
storageAccessKey = process.env[ServiceClient.EnvironmentVariables.AZURE_STORAGE_ACCESS_KEY]; | ||
@@ -263,0 +264,0 @@ } else if (ServiceClient.isEmulated()) { |
@@ -22,3 +22,2 @@ /** | ||
var ServiceClient = require('../core/serviceclient'); | ||
var ServiceBusServiceBase = require('./servicebusservicebase'); | ||
@@ -31,3 +30,3 @@ | ||
var HeaderConstants = Constants.HeaderConstants; | ||
var ServiceClientConstants = require('../core/serviceclientconstants'); | ||
var queueResult = require('./models/queueresult'); | ||
@@ -46,3 +45,3 @@ var queueMessageResult = require('./models/queuemessageresult'); | ||
* | ||
* @param {string} [namespaceOrConnectionString] The service bus namespace or the connection string. | ||
* @param {string} [configOrNamespaceOrConnectionString] The service bus namespace or the connection string. | ||
* @param {string} [accessKey] The password. Only necessary if no connection string passed. | ||
@@ -54,5 +53,5 @@ * @param {string} [issuer] The issuer. | ||
*/ | ||
function ServiceBusService(namespaceOrConnectionString, accessKey, issuer, acsNamespace, host, authenticationProvider) { | ||
function ServiceBusService(configOrNamespaceOrConnectionString, accessKey, issuer, acsNamespace, host, authenticationProvider) { | ||
ServiceBusService['super_'].call(this, | ||
namespaceOrConnectionString, | ||
configOrNamespaceOrConnectionString, | ||
accessKey, | ||
@@ -253,4 +252,4 @@ issuer, | ||
var relativePath = message.location.substr( | ||
message.location.indexOf(ServiceClient.CLOUD_SERVICEBUS_HOST + '/') + | ||
ServiceClient.CLOUD_SERVICEBUS_HOST.length + 1); | ||
message.location.indexOf(ServiceClientConstants.CLOUD_SERVICEBUS_HOST + '/') + | ||
ServiceClientConstants.CLOUD_SERVICEBUS_HOST.length + 1); | ||
@@ -286,4 +285,4 @@ var webResource = WebResource.del(relativePath) | ||
var relativePath = message.location.substr( | ||
message.location.indexOf(ServiceClient.CLOUD_SERVICEBUS_HOST + '/') + | ||
ServiceClient.CLOUD_SERVICEBUS_HOST.length + 1); | ||
message.location.indexOf(ServiceClientConstants.CLOUD_SERVICEBUS_HOST + '/') + | ||
ServiceClientConstants.CLOUD_SERVICEBUS_HOST.length + 1); | ||
@@ -290,0 +289,0 @@ var webResource = WebResource.put(relativePath) |
@@ -21,3 +21,2 @@ /** | ||
var ServiceClient = require('../core/serviceclient'); | ||
var ServiceBusServiceClient = require('../core/servicebusserviceclient'); | ||
@@ -27,2 +26,3 @@ | ||
var Constants = require('../../util/constants'); | ||
var ServiceClientConstants = require('../core/serviceclientconstants'); | ||
var QueryStringConstants = Constants.QueryStringConstants; | ||
@@ -40,3 +40,3 @@ var HeaderConstants = Constants.HeaderConstants; | ||
* | ||
* @param {string} [namespaceOrConnectionStringOrSettings] The service bus namespace or the connection string or service settings. | ||
* @param {string} [configOrNamespaceOrConnectionStringOrSettings] The sdk configuraiton, service bus namespace, the connection string, or service settings. | ||
* @param {string} [accessKey] The password. Only necessary if no connection string passed. | ||
@@ -48,23 +48,27 @@ * @param {string} [issuer] The issuer. | ||
*/ | ||
function ServiceBusServiceBase(namespaceOrConnectionStringOrSettings, accessKey, issuer, acsNamespace, host, authenticationProvider) { | ||
function ServiceBusServiceBase(configOrNamespaceOrConnectionStringOrSettings, accessKey, issuer, acsNamespace, host, authenticationProvider) { | ||
var serviceBusSettings; | ||
if (_.isObject(namespaceOrConnectionStringOrSettings)) { | ||
serviceBusSettings = namespaceOrConnectionStringOrSettings; | ||
} else if (namespaceOrConnectionStringOrSettings && accessKey === undefined) { | ||
if(!configOrNamespaceOrConnectionStringOrSettings || _.isFunction(configOrNamespaceOrConnectionStringOrSettings)) { | ||
// It's a config or blank. Create from config, which will handle | ||
// defaulting back to environment vars if needed. | ||
serviceBusSettings = ServiceBusSettings.createFromConfig(configOrNamespaceOrConnectionStringOrSettings); | ||
} else if (_.isObject(configOrNamespaceOrConnectionStringOrSettings)) { | ||
serviceBusSettings = configOrNamespaceOrConnectionStringOrSettings; | ||
} else if (configOrNamespaceOrConnectionStringOrSettings && accessKey === undefined) { | ||
// If namespaceOrConnectionString was passed and no accessKey was passed, assume connection string | ||
serviceBusSettings = ServiceBusSettings.createFromConnectionString(namespaceOrConnectionStringOrSettings); | ||
serviceBusSettings = ServiceBusSettings.createFromConnectionString(configOrNamespaceOrConnectionStringOrSettings); | ||
} else { | ||
if (!namespaceOrConnectionStringOrSettings) { | ||
namespaceOrConnectionStringOrSettings = process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE]; | ||
if (!configOrNamespaceOrConnectionStringOrSettings) { | ||
configOrNamespaceOrConnectionStringOrSettings = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE]; | ||
} | ||
if (!accessKey) { | ||
accessKey = process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_ACCESS_KEY]; | ||
accessKey = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_ACCESS_KEY]; | ||
} | ||
if (!issuer) { | ||
issuer = process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_ISSUER]; | ||
issuer = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_ISSUER]; | ||
if (!issuer) { | ||
issuer = ServiceClient.DEFAULT_SERVICEBUS_ISSUER; | ||
issuer = ServiceClientConstants.DEFAULT_SERVICEBUS_ISSUER; | ||
} | ||
@@ -74,11 +78,11 @@ } | ||
if (!acsNamespace) { | ||
acsNamespace = process.env[ServiceClient.EnvironmentVariables.AZURE_WRAP_NAMESPACE]; | ||
acsNamespace = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_WRAP_NAMESPACE]; | ||
if (!acsNamespace) { | ||
acsNamespace = namespaceOrConnectionStringOrSettings + ServiceClient.DEFAULT_WRAP_NAMESPACE_SUFFIX; | ||
acsNamespace = configOrNamespaceOrConnectionStringOrSettings + ServiceClientConstants.DEFAULT_WRAP_NAMESPACE_SUFFIX; | ||
} | ||
} | ||
var endpoint = url.format({ protocol: 'https:', port: 443, hostname: namespaceOrConnectionStringOrSettings + '.' + ServiceClient.CLOUD_SERVICEBUS_HOST }); | ||
var stsendpoint = url.format({ protocol: 'https:', port: 443, hostname: acsNamespace + '.' + ServiceClient.CLOUD_ACCESS_CONTROL_HOST }); | ||
var endpoint = url.format({ protocol: 'https:', port: 443, hostname: configOrNamespaceOrConnectionStringOrSettings + '.' + ServiceClientConstants.CLOUD_SERVICEBUS_HOST }); | ||
var stsendpoint = url.format({ protocol: 'https:', port: 443, hostname: acsNamespace + '.' + ServiceClientConstants.CLOUD_ACCESS_CONTROL_HOST }); | ||
@@ -85,0 +89,0 @@ if (host) { |
@@ -24,2 +24,3 @@ /** | ||
var Constants = require('../../util/constants'); | ||
var ServiceClientConstants = require('../core/serviceclientconstants'); | ||
var HeaderConstants = Constants.HeaderConstants; | ||
@@ -38,8 +39,8 @@ | ||
if (!acsHost) { | ||
var acsNamespace = process.env[ServiceClient.EnvironmentVariables.AZURE_WRAP_NAMESPACE]; | ||
var acsNamespace = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_WRAP_NAMESPACE]; | ||
if (!acsNamespace) { | ||
acsNamespace = process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE] + ServiceClient.DEFAULT_WRAP_NAMESPACE_SUFFIX; | ||
acsNamespace = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE] + ServiceClientConstants.DEFAULT_WRAP_NAMESPACE_SUFFIX; | ||
} | ||
acsHost = url.format({ protocol: 'https:', port: 443, hostname: acsNamespace + '.' + ServiceClient.CLOUD_ACCESS_CONTROL_HOST }); | ||
acsHost = url.format({ protocol: 'https:', port: 443, hostname: acsNamespace + '.' + ServiceClientConstants.CLOUD_ACCESS_CONTROL_HOST }); | ||
} | ||
@@ -49,6 +50,6 @@ | ||
if (!this.issuer) { | ||
this.issuer = process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_ISSUER]; | ||
this.issuer = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_ISSUER]; | ||
if (!this.issuer) { | ||
this.issuer = ServiceClient.DEFAULT_SERVICEBUS_ISSUER; | ||
this.issuer = ServiceClientConstants.DEFAULT_SERVICEBUS_ISSUER; | ||
} | ||
@@ -59,3 +60,3 @@ } | ||
if (!this.accessKey) { | ||
this.accessKey = process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_ACCESS_KEY]; | ||
this.accessKey = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_ACCESS_KEY]; | ||
} | ||
@@ -62,0 +63,0 @@ |
@@ -62,3 +62,4 @@ /** | ||
* RegEx: string, | ||
* XmlNode: string | ||
* XmlNode: string, | ||
* [IncludeIfEmpty]: optional boolean | ||
* } | ||
@@ -74,3 +75,3 @@ * @param {object} role The part of role object currently processing. | ||
RoleParser.prototype.handlePrimitiveType = function (metadata, role, key, serializeTo, output) { | ||
if (typeof (role[key]) === 'boolean' || role[key]) { | ||
if (typeof (role[key]) === 'boolean' || role[key] || metadata.IncludeIfEmpty) { | ||
if (serializeTo === 'XML') { | ||
@@ -77,0 +78,0 @@ output.ele(metadata.XmlNode).txt(role[key]); |
@@ -245,3 +245,4 @@ { | ||
"RegEx": "NIL", | ||
"XmlNode": "UserPassword" | ||
"XmlNode": "UserPassword", | ||
"IncludeIfEmpty": true | ||
}, | ||
@@ -248,0 +249,0 @@ "DisableSshPasswordAuthentication": |
@@ -23,3 +23,3 @@ /** | ||
var WebResource = require('../../http/webresource'); | ||
var ServiceClient = require('../core/serviceclient'); | ||
var ServiceClientConstants = require('../core/serviceclientconstants'); | ||
@@ -61,3 +61,3 @@ var OdataHandler = require('../../util/odatahandler'); | ||
if (!host) { | ||
host = ServiceClient.CLOUD_DATABASE_HOST; | ||
host = ServiceClientConstants.CLOUD_DATABASE_HOST; | ||
} | ||
@@ -64,0 +64,0 @@ |
@@ -2435,2 +2435,10 @@ /** | ||
/** | ||
* The signed version argument for shared access signature. | ||
* | ||
* @const | ||
* @type {string} | ||
*/ | ||
SIGNED_VERSION: 'sv', | ||
/** | ||
* The block identifier query string argument for blob service. | ||
@@ -2437,0 +2445,0 @@ * |
@@ -13,3 +13,3 @@ { | ||
], | ||
"version": "0.7.8", | ||
"version": "0.7.9", | ||
"description": "Windows Azure Client Library for node", | ||
@@ -31,3 +31,4 @@ "tags" : ["azure", "sdk"], | ||
"validator": ">= 0.4.12", | ||
"wns": ">= 0.5.3" | ||
"wns": ">= 0.5.3", | ||
"envconf": ">= 0.0.1" | ||
}, | ||
@@ -34,0 +35,0 @@ "devDependencies": { |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
982575
117
22643
11
85
+ Addedenvconf@>= 0.0.1
+ Addedenvconf@1.1.0(transitive)