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: 'http://172.16.0.11:8080',
}
};
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!
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.
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 http://0.0.0.0:4200
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 http://0.0.0.0:4200/
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
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.
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.