Custom ENV vars in ember-cli


I added SKYDNS_HOST var below in config/environment.js file.

module.exports = function(environment) {
  var ENV = {
    modulePrefix: 'skydns',
    environment: environment,

    APP: {
      // Here you can pass flags/options to your application instance
      // when it is created
      SKYDNS_HOST: '',
  if (environment === 'development') {

Now how do I access the variable? I tried with window.ENV, window.MyApp.ENV. I even tried putting that variable in side if (environment === 'development') { as I found via google. But nothing seems to work?

So, how do I set and access config variables in ENV ?

I found some solution that says to put in Initializers. But that won’t be ENV specific approach!




Well, I can’t even access the MyAppENV.

I created the app with the name skydns.

ember new skydns.

So does it mean that I can access the constant SkyDnsENV? It says its undefined.


Yes I think it must be SkydnsENV.APP.SKYDNS_HOST or skydnsENV.APP.SKYDNS_HOST It worked like this in Ember-CLI 0.0.44 and I think it still works in 0.1.1 like this but am not sure.


One more thing to notice is:

This app uses ember-cli 0.1.0.

I’d another app previously which uses 0.0.40 and I had scaffolded it as ember new lgebs. In this app, I can access Lgebs constant.

Is there any changes in recent version of ember-cli?


Can you scaffold one app with recent version of ember-cli and test it out?


I installed firebug lite and I see the ENV in Ember-CLI 0.0.44 but not in 0.1.1?? I will try to find where it is moved to.


Yup, that is the case. It might be moved or removed. Yes, do please try to find it.


Found it! It is now direct under your appname skydns.SKYDNS_HOST. You can see it in Firebug.


It did not. says skydns is undefined.

What is the ember-cli and emberjs version that you tried upon?


0.1.1 What do you see in firebug?


Well I’m having a hard time.

Updated the ember-cli to 0.1.1 and scaffolded a new app with name Galo

ember new galo

And I can access it as Galo, not galo.

± ember serve
version: 0.1.1
Livereload server on port 35729
Serving on

Build successful - 265ms.

Slowest Trees                  | Total
Concat                         | 68ms
ES6Concatenator                | 24ms
ES3SafeFilter                  | 23ms
JSHint - App                   | 21ms
JSHint - Tests                 | 15ms
CustomStaticCompiler           | 15ms

And now this is with my existing app. I updated ember-cli with npm link ember-cli and ran it. But I don’t get the app constant. Neither with SkyDns nor skydns.

± ember serve
version: 0.1.1-master-7e3d3bd055
Livereload server on port 35729
Serving on

Build successful - 1611ms.

Slowest Trees                  | Total
TreeMerger (appAndDependencies) | 218ms
TreeMerger (stylesAndVendor)   | 176ms
ES6Concatenator                | 151ms
TreeMerger (ExternalTree)      | 138ms
TreeMerger (vendor)            | 101ms
JSHint - App                   | 94ms
CustomStaticCompiler           | 92ms


Did you check if the index.html file in your app folder has the same structure for both projects? My first guess is they are not.


I don’t believe this has been said yet, but…I believe you can just import the ENV variables like so:

import ENV from '../config/environment';


Well I’ve tried this before putting the question here and at that time, this approach was not working either.


Ok, let me check and verify it.


Well, I finally got it nailed. The main change was the "ember-export-application-global": "^1.0.0", module. I think this was extracted out in separate module when coming near to 0.1.1 of ember-cli. @broerse Thanks for your input! I might post a blog about this.


Add a link when you do.


hi all! @millisami do you find the solution ? Can you please share with us ? I have the same problem and I don’t know how to access the variables from the environment file.