(function () {
/**
* Value controlling what context the app is executed within. This effects the base urls
* used for API calls. By default, the app will call the production APIs when run on `localhost`.
* @name currentEnvironment
* @memberof mohistory
* @ngdoc value
*/
angular
.module('mohistory').value('currentEnvironment', determineEnvironment());
/**
* Function to determine environment context for the app. This effects the base urls
* used for API calls. By default, the app will call the production APIs when run on `localhost`.
* To customize the running environment, add a value to the `overwrite` variable. The new value
* must match a key in the `config.js` file.
* Possible Environments Include:
* `DEV_PROD`: development front-end and production API
* `DEV_DEV`: development front-end and development API
* `PRODUCTION: production front-end and production API
* @namespace currentEnvironment
* @memberof currentEnvironment
* @name determineEnvironment
*/
function determineEnvironment() {
// If `window` is not available, the code is running outside the
// browser, default to `DEV_DEV`.
if (window) {
// ADD CUSTOM VARIABLE HERE
var overwrite = 'SIERRA';
if (!overwrite && window.location.hostname === 'localhost') {
return 'DEV_PROD';
} else if (overwrite) {
console.warn('Working with custom execution environment: ' + overwrite);
return overwrite;
}
return 'PRODUCTION';
} else {
return 'DEV_DEV';
}
}
})()