diff --git a/src/app/services/provider/storyboard_api_base.js b/src/app/services/provider/storyboard_api_base.js index 73511c1a..35f25a0d 100644 --- a/src/app/services/provider/storyboard_api_base.js +++ b/src/app/services/provider/storyboard_api_base.js @@ -15,38 +15,10 @@ */ /** - * This provider attempts to discover the API URI base for storyboard, by - * checking various expected configuration parameters. + * This provider injects a sane default for the storyboardApiBase property. It + * may be overridden simply by injecting a constant of the same name in any + * module which lists sb.services as a dependency. * * @author Michael Krotscheck */ -angular.module('sb.services') - .config(function ($provide, $injector) { - 'use strict'; - - var propertyName = 'storyboardApiBase'; - - // First to see whether something's already been injected. - if ($injector.has(propertyName)) { - // We've already got one, exit. - return; - } - - // Do we have a global ENV property with something we can use? - if (window.hasOwnProperty('ENV')) { - var ENV = window.ENV; - if (ENV !== null && ENV.hasOwnProperty(propertyName)) { - $provide.constant(propertyName, ENV[propertyName]); - return; - } - } - // If there is a tag, then we can use that. - if (document.getElementsByTagName('base').length > 0) { - $provide.constant(propertyName, ''); - return; - } - - // Neither of those work, so default to something sane on the current - // domain - $provide.constant(propertyName, '/api/v1'); - }); +angular.module('sb.services').constant('storyboardApiBase', '/api/v1'); diff --git a/test/unit/services/provider/storyboard_api_base_test.js b/test/unit/services/provider/storyboard_api_base_test.js index 4d6e13a7..b7fc1fe5 100644 --- a/test/unit/services/provider/storyboard_api_base_test.js +++ b/test/unit/services/provider/storyboard_api_base_test.js @@ -29,20 +29,6 @@ describe('storyboardApiBase', function () { }); }); - it('should detect a value in window.ENV', function () { - window.ENV = { - storyboardApiBase: 'https://localhost:8080/api/v1' - }; - - module('sb.services'); - - inject(function (storyboardApiBase) { - expect(storyboardApiBase).toEqual('https://localhost:8080/api/v1'); - }); - - delete window.ENV; - }); - it('should defer to properties injected at the parent level.', function () { angular.module('testModule', ['sb.services']) .config(function ($provide) {