Below code can be used to determine different config value based on the environment the code is running in.

```//Environment Specifc Variable
//Environment Specifc Variable
Center.Config = {
Local: {
Api: 'https://localhost:44300/'
},
Dev: {
Api: 'https://dev.center.com/'
},
QA: {
Api: 'https://qa.center.com/'
},
Production: {
Api: 'https://prod.center.com/'
},
getValue: function (key) {
var env;
switch (window.location.hostname) {
case "localhost":
case "127.0.0.1":
env = 'Local';
break;
case "dev.web.com":
env = 'Dev';
break;
case "qa.web.com":
env = 'Production';
break;
case "prod.web.com":
env = 'Production';
break;
default:
throw ('Unknown environment: ' + window.location.hostname);
}
return Center.Config[env][key];
}
};

options.url = Center.Config.getValue(‘Api’) + options.url;“`

options.url = Center.Config.getValue(‘Api’) + options.url;

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>