My App is not loading all the parameters from the enviroment.js file, only the ones that are by default.
I install this package ember-g-recaptcha and then you need to put a param in the config file.
The problem is that I create a demo app with ember-cli and I'ts working, but in my real app is not, maybe someone has any idea for why is not loading the params.
I try change the version of the modules in the package.json, but no luck, but I think is still over there the solution.
In my app the object of the config file throw this when you do this console log:
console.log(Ember.getOwner(this).resolveRegistration('config:environment'));
Object {
modulePrefix: "listings-search",
environment: "development",
rootURL: "/",
EmberENV: Object,
APP: Object, ember-cli-mirage: Object, exportApplicationGlobal: true
}
In the demo app this is the result:
Object {
modulePrefix: "lala",
environment: "development",
rootURL: "/",
locationType: "auto",
gReCaptcha: Object,
EmberENV: Object,
APP: Object, ember-cli-mirage: Object, exportApplicationGlobal: true
}
This is my enviroment.js file
/* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'listings-search',
environment: environment,
rootURL: '/',
locationType: 'auto',
gReCaptcha: {
siteKey: 'asdasdads'
},
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
},
EXTEND_PROTOTYPES: {
// Prevent Ember Data from overriding Date.parse.
Date: false
}
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
}
};
if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
// ENV['ember-cli-mirage'] = {
// enabled: false
// }
}
if (environment === 'test') {
// Testem prefers this...
ENV.locationType = 'none';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing';
}
if (environment === 'production') {
}
return ENV;
};
Also when I try to access to my environment.js in this way that the official guide said in this link, throw this error in the console:
Could not find module `/appname/config/environment` imported from `appname/components/name-component`
Version:
The problem is that Ember.js inject the Enviroment.js file in a meta tag in the HTML, I didn't have any knowledge of this because the documentation does not say anything about this.
We are using a different strategy for the use of ember without the routes, so the meta-tag was harcoded in the code. I didn't see it (also I didn't pay attention to this, because i didn't know about the config params in the meta-tag)
Since Ember.js 2.3 we can set up in our broccoli file (ember-cli-build.js) the parameter storeConfigInMeta: false
and the config file will be embedded in our javascript file.