Reputation: 2896
I'm starting to write a ST 2.4 app using Sencha Cmd 5. Where do I specify build-specific runtime settings, such as server hostname to use in app for ajax calls?
Example for server host:
production: www.example.com
development: local.example.com
testing: test.example.com
Obviously, my app is responsible for taking the hostname and using for the ajax call url. But can I specify my app settings such as server hostname in app.json, such that it will be an available Javascript object when the app launches?
Upvotes: 0
Views: 46
Reputation: 21
Sorry for bad english.!!
set url path as a window variable, so that it becomes global variable, you access in your ajax call
Eg: window.WebUrl = "192.168.1.12/AppName";
in your case
production: window.WebUrl = "www.example.com";
development: window.WebUrl = "local.example.com";
testing: window.WebUrl = "test.example.com";
put window.WebUrl in your Index.html, Include all three, comment whichever url you don't want to enable.
for development:
//window.WebUrl = "www.example.com";
window.WebUrl = "local.example.com";
//window.WebUrl = "test.example.com";
Upvotes: 0