I've got two very similar, and simple, apps.
I start both of them as 'ember s' with no other arguments.
They both rely on a backend found at http://localhost:8000 .
One of them works perfectly the other is convinced it should be making API calls to http://localhost:4200 .
So for instance rendering a list screen on the working one involves a GET to http://localhost:8000/api/todos . Rendering a list screen on the non-working one results in a GET request being made to http://localhost:4200/api/projects .
The location of the backend is defined in config/application.js
via the ENV.host
property.
How can I further diagnose this problem to see why the non-working app ignores ENV.host
?
Any ideas welcome.
I'll put the relevant configs below in case that helps.
The problem config/application.js
looks like this :
module.exports = function(environment) {
var ENV = {
host: 'https://example.com',
modulePrefix: 'spuv-ember',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
},
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.host = 'http://localhost:8000';
}
if (environment === 'test') {
// Testem prefers this...
ENV.baseURL = '/';
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;
};
The working config\application.js
looks like this :
module.exports = function(environment) {
var ENV = {
host: 'https://example.com',
modulePrefix: 'todo-ember',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
}
};
ENV['ember-simple-auth'] = {
authenticationRoute: 'login',
routeAfterAuthentication: 'todos',
routeIfAlreadyAuthenticated: 'todos'
};
if (environment === 'development') {
ENV.host = 'http://localhost:8000';
// 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;
}
if (environment === 'test') {
// Testem prefers this...
ENV.baseURL = '/';
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;
};
Aucun commentaire:
Enregistrer un commentaire