lundi 28 novembre 2016

Ember config file after build

I want to take some config properties from a config file instead from index.html(not from the meta generated from config/environment), for example myConfig.js with two variables (lang and host) that can be changed after build. Currently I put that variables in config/enviroment, but i want to separate this variables from this data.

For example:

index.html:

<!DOCTYPE html>
   ...
   <meta name="myapp/config/environment" content="%7B%22modulePrefix%22%3A%22user%22%2C%22environment%22%3A%22development%22%2C%22baseURL%22%3A%22/%22%2C%22locationType%22%3A%22auto%22%2C%22contentSecurityPolicy%22%3A%7B%22default-src%22%3A%22%27none%27%20localhost%22%2C%22script-src%22%3A%22%27self%27%20%27exportApplicationGlobal%22%3Atrue%7D">
   ...
   <script src="myconfig.js" ></script>
   ...
</html>

myconfig.js:

module.exports = function() {

   var MYCONFIG = {
       lang: 'en',
       host: 'http://.....'
   }

   return MYCONFIG ;
};

How this can be done?

Any help will be greatly appriciated




Aucun commentaire:

Enregistrer un commentaire