Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports.getEnvironment = function(environmentName) {
var azureEnv;
switch(environmentName) {
   case 'AzureCloud':
       azureEnv = AzureEnvironment.Azure;
       break;
   case 'AzureChinaCloud':
azureEnv = AzureEnvironment.AzureChina;
       break;
   case 'AzureGermanCloud':
       azureEnv = AzureEnvironment.AzureGermanCloud;
       break;
case 'AzureUSGovernment':
azureEnv = AzureEnvironment.AzureUSGovernment;
break;
   default:
throw new Error(util.format('Environment %s is not supported', environmentName));
}
var len = azureEnv.resourceManagerEndpointUrl.length;
if (azureEnv.resourceManagerEndpointUrl[len - 1] != '/') {
azureEnv.resourceManagerEndpointUrl = azureEnv.resourceManagerEndpointUrl + '/' ;
}
return azureEnv;
};