mercredi 15 juillet 2020

EmberJs: how to dynamicaly inject data into ENV?

I need to dynamically inject some data before build stage.

In my config/environment.js i have:

module.exports = function(environment) {
  environment = 'production';
  var ENV = {
    APP: {
      API_HOST: 'https://apihost1.com,
      secret: 'key1'
     }
   };
  return ENV;
};

How do i can to dynamically change "APP" object to something else:

    APP: {
      API_HOST: 'https://apihost2.com,
      secret: 'key2'
     }

before build according to an executing command in my package.json?

"scripts": {
    "build 1": "$CONFIG_NAME ember build",
},

I was thinking about npm scripts but could not implement that. Is anyone has a solution for it?




Aucun commentaire:

Enregistrer un commentaire