I would like to configure a URL differently in my ember app depending if the app is running in production or development mode. Is this possible to do by loading the endpoints into config/environment.js
and accessing the value of the ENV object in a handlebars template? Maybe I have to expose the ENV value in a controller? Or is there some other mechanism for doing this?
Something like this:
// config/environment.js
if (environment === 'development') {
ENV.zzz.url = "http://www.reddit.com";
}
if (environment === 'production') {
ENV.zzz.url = "http://www.google.com";
}
// app/controllers/application.js
export default Ember.Controller.extend({
siteUrl: ENV.zzz.url
...
// somefile.hbs
<a href="">Funspot</a>
Aucun commentaire:
Enregistrer un commentaire