Where to specify build-specific runtime settings?

60 views Asked by At

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?

1

There are 1 answers

0
Manjappa On

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";