Access ENV object from the console


#1

I’m trying to debug an issue with a setting value on the ENV object set in the environment.js file but I don’t know how to access the ENV object from the console.

I see that EmberENV object is available, but the setting I’m looking at is on the ENV.APP object.

For example, I’m trying to see the value for the ENV.APP.mySetting property below:

let ENV = {
  ...
  APP: {
    mySetting: 'someValue'
  }
}

What’s the easiest way to see that setting from the console?


#2

I’m curious about this myself; when I wanted to do this last week, I resorted to looking at the index.html file and fishing through the confusing serialised form. It works, but it’s subpar.

If that hadn’t worked for me, I’d have imported the configuration into a class file and saved it on window :grimacing:


#3
require('<your apps modulePrefix>/config/environment').default;

So assuming you have an app whose modulePrefix is travis (:wink:) you would do:

require('travis/config/environment').default