0

I have an application used to call web services where base URL are different for different environment (dev/SIT/UAT/preProd/prod etc...) So I have decided to add base URL on Config.json file.

"env:development": { 
"BASE_URL" : "https://xxxx/api/" 
}, 
"env:SIT": { 
"BASE_URL" : "http://1yyyy/api/" 
},
"env:UAT": { 
"BASE_URL" : "http://1yyyy/api/" 
},
"env:production": { 
"BASE_URL" : "ccccc" 
},

Now My question is... If I want to make a build for SIT or UAT or Production, How that app will take appropriate base url. How to define that I am running my app on development SIT, UAT or production?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Raju Mahato
  • 129
  • 2
  • 14

1 Answers1

3

You cannot define your own environments. There are predefined ones that are used on compile of your app. There is only 1 environment in the compiled app.

You can find which environment does what in the documentation of Appcelerator

Basically, development is for simulators, test for devices and production if you compile ad-hoc or for app store.

If you want different URL's for different situations you will need to define them in the global part for example and make logic yourself inside the app to pick the right URL's.

Rene Pot
  • 24,681
  • 7
  • 68
  • 92
  • Thanks Rene, Yes I have that logic which will pick that URL depending on situation. But I am looking for any predefine process that Appcelerator provides to do the same which may reduce some code. – Raju Mahato Nov 24 '16 at 13:19
  • it is not possible to customise config.json like that. Maybe you can use grunt (or similar) to adjust the file for you – Rene Pot Nov 24 '16 at 13:27