简体   繁体   English

定义应用程序的运行环境(SIT / UAT / prod)

[英]Define running environment (SIT/UAT/prod) of an app

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. 我有一个用于调用Web服务的应用程序,该应用程序的基本URL对于不同的环境(dev / SIT / UAT / preProd / prod等)是不同的。因此,我决定在Config.json文件上添加基本URL。

"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. 现在我的问题是...如果我想为SIT或UAT或Production进行构建,该应用程序将如何采用适当的基本URL。 How to define that I am running my app on development SIT, UAT or production? 如何定义我在开发SIT,UAT或生产环境中运行我的应用程序?

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. 编译的应用程序中只有1个环境。

You can find which environment does what in the documentation of Appcelerator 您可以在Appcelerator文档中找到哪个环境在做什么

Basically, development is for simulators, test for devices and production if you compile ad-hoc or for app store. 基本上, development是针对模拟器的,如果您临时编译或针对应用商店,则针对设备和production test

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. 如果您希望在不同情况下使用不同的URL,则需要在global部分中进行定义,例如,自己在应用程序内部进行逻辑选择,以选择正确的URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM