mercredi 2 mars 2016

Ember: Local config for development

I want to share my ember-project between all members in my team. Since every development environment is different (OS, VM for server, etc.) I thought it would be best practice to hold an local-environmen-file in each repository clone which will be ignored by git and just holds the specific config of each team-member.

For Example in my app the application adapter holds the "host:" entry which is a computed-property which uses the local-environment-file and reads the IP of the server (where to connect to).

My current approach looks like that:

// ./config/localenv.js

module.exports = function() {
  var LOCALENV = {

    host: "http://ift.tt/1oPM388"

  };

  return LOCALENV;
};

And Im importing it in my adapter like that:

// ./app/pods/application/adapter.js

import DS from 'ember-data';
import LOCALENV from 'localenv';

export default DS.RESTAdapter.extend({

  host: Ember.computed(function() {
    return LOCALENV.host;

  })

});

Unfortunately ember returns error logs in the browser console (the referenced/imported module was not found...). What am Im doing wrong?




Aucun commentaire:

Enregistrer un commentaire