Unversion environment.js for Git


Hey there, it’s my first post here so feel free to tell me if I’m posting in the wrong section.

I haven’t found discussions on that point, so here I go: why is environment.js versioned in Git? In our use cases, we have always needed a different environment configuration, partly because we couldn’t find any other convenient place where to store parameters (like app secrets for OAuth, etc…). What we’ve done is that we’ve unversioned environment.js from Git and copied a reference file that contains the default config, which is named environment.js.dist.

Coming from the PHP world with Symfony, that seemed like a rather logical thing to do. Other parameters like the local Ember-cli port might be good to unversion as well. At the moment, we’d have to make a .ember-cli.dist in order to run Ember-cli on different ports on different machines without risking overriding each other all the time.

What are other ways to store such parameters on a “machine per machine” basis? Should Ember-cli unversion some of these files by default or is it the devs responsability? What do you guys think?

Edit: Symfony2 uses composer to automatically add missing params to unversioned files. Quite useful in that case.


Even Better approach is to store the secrets and other parameters in the environment variable rather than the environment.js file. This is one of rules of designing Twelve-Factor Apps. You can change the environment variables machine per machine basis. To use environment variables in your ember.js app, please checkout ember-cli-dotenv. Don’t put every config in the environment variables: there are a lot of configs which can safely stay in the environment.js file.

Caution: If you go for twelve factor app methodology, don’t commit your .env file to git.


I’ll look into the Twelve-Factor App method, thank you!