Commit 74db46b
Changed files (3)
app
infrastructure
__tests__
app/boot/wire-up-components-into.js
@@ -20,9 +20,7 @@ export default class WireUpComponentsInto {
});
}).asSingleton();
this.registry.register('applicationStorage', ApplicationStorage).asSingleton();
- this.registry.register('configuration', () => {
- return new Configuration('development');
- }).asSingleton();
+ this.registry.register('configuration', Configuration).asSingleton();
this.registry.register('api', Api).asSingleton();
this.registerSubscribers(commands);
app/infrastructure/__tests__/configuration_spec.js
@@ -3,27 +3,11 @@ import Configuration from '../configuration';
describe("Configuration", ()=> {
let subject = null;
- describe("development", () => {
- beforeEach(()=> {
- subject = new Configuration('development');
- });
-
- it ("loads the api host", function() {
- expect(
- subject.value_for("API_HOST")
- ).toEqual('http://localhost:3000')
- });
+ beforeEach(() => {
+ subject = new Configuration();
});
- describe("production", () => {
- beforeEach(()=> {
- subject = new Configuration('production');
- });
-
- it ("loads the api host", function() {
- expect(
- subject.value_for("API_HOST")
- ).toEqual('https://www.stronglifters.com')
- });
+ it ("loads the api host", function() {
+ expect(subject.value_for("API_HOST")).toEqual('https://www.stronglifters.com')
});
});
app/infrastructure/configuration.js
@@ -1,20 +1,10 @@
var _defaults = {
- development: {
- API_HOST: 'http://localhost:3000',
- ENV: 'development'
- },
- production: {
- API_HOST: 'https://www.stronglifters.com',
- ENV: 'production'
- }
+ API_HOST: 'https://www.stronglifters.com',
+ ENV: 'production'
};
export default class Configuration {
- constructor(environment) {
- this.environment = environment;
- }
-
value_for(key) {
- return process.env[key] || _defaults[this.environment][key];
+ return process.env[key] || _defaults[key];
}
}