Blueprint that modifies environment config?

I’m relatively new to Ember and was wondering if there is a way to create a blueprint/generator that would inject a new value into the environment config. Is there some Ember magic that allows an existing file to act as the blueprint template? My ideal implementation would look something like this:

ember g platform foo

// config/environment.js
module.exports = function(environment) {
var ENV = {
  // Existing config values here...
  APP: {
    platforms: {
      foo: 'abc123'  // Generator injects the 'foo' platform and a GUID
    }
  };
  // Existing environment-specific settings here...
  return ENV;
};

I realize this is probably more of a Node question (using fs.readFile() and fs.writeFile()), but any ideas are appreciated – thanks!

1 Like

I think you’re confusing things. The blueprint will generate code which is then included in an application (for example, a fancy button). The addon will install the blueprint and perform any necessary modifications to the environment (for example, adding a bower dependency or including some CSS so the fancy button will work correctly). Check out the ember-cli docs for a discussion of what hooks are available for add ons. There are several that will do the trick, but it’s difficult to tell which one is for you without further information. The config hook (which it looks like is not documented; read some addon code to see how it actually works) might be what you want.