As in the application I need to have some configured variables which are to be global and I am using them across modules. My config file may look like.
config.js:
var config = {
baseServiceUrl: 'http://localhost/baseServiceUrl',
baseUrl: 'http://localhost/baseUrl',
mapping_764: {
location:'Austin',
emailAddress:'austin@customerservice.com',
registerLink:'https://www.customercare.com/en/austin/registration/',
fbLikeLink:'https://www.facebook.com/customercare.austin',
microSite: 'http://austin.customercare.com/'
}
}
I am just loading this file using script tag along with requirejs.
<script src="js/app/config.js"></script>
<script data-main="js/main" src="js/libs/require/require.js"></script>
Now the global variable(object) config can be used in all the modules and also from browser console. So I was thinking what if someone changes this config attributes, the application is definitely going to crash because this config variable is used for service calls and for many other things.
Is there any way to handle this kind of issues.?