cancel
Showing results for 
Search instead for 
Did you mean: 

How to differentiate between development environments (dev, qas, prd)?

Former Member
0 Kudos

Hi experts,

I need differentiate my development in ui5 between different environments(dev qas prd)

Any idea ?

Thanks,

Regards.

Accepted Solutions (1)

Accepted Solutions (1)

saurabh_vakil
Active Contributor
0 Kudos

Hi Axel,

Can you elaborate a bit more on what exactly you are looking for? Normally we would have 1 UI5 app and its corresponding OData service (developed on backend/gateway server and registered on gateway) in the development environment - these would be transported to QAS and PRD systems. The UI5 app would internally call the OData service using a relative URL, so no matter from which environment you run the app, it will fetch the data from the corresponding backend system.

Regards,

Saurabh

Former Member
0 Kudos

Hi Saurabh


Thank you for your answer.


The url of service odata I am using is something like this.

DEV:

http://dev-fiori.test.com.pe:8000/sap/opu/odata/sap/Z_FIORI

QAS:

http://qas-fiori.test.com.pe:8000/sap/opu/odata/sap/Z_FIORI

I need to know, how to differentiate the call from my odata service (dev, qas, prd) in my app UI5.

Thanks,

Regards.

saurabh_vakil
Active Contributor
0 Kudos

Hi Axel,

As stated earlier you should ideally use relative URL for calling the OData service from the UI5 app.

In your case you can use the URL "/sap/opu/odata/sap/Z_FIORI" in your ODataModel. Since your UI5 app will be deployed as a BSP on the front end server and the OData service would also be registered on the front end server, the UI5 app can access the relative URL from the respective environment, be it DEV, QAS or PRD.

Regards,

Saurabh

former_member182372
Active Contributor
0 Kudos

create a file systems.json

{

"dev-fiori" : "DEV",

"qas-fiori": "QA",

....

}

var enviromentModel = new sap.ui.model.json.JSONModel();

  

   enviromentModel.attachEvent("requestCompleted", function() {

//fire en event that data loaded to resolve a promise or fire event, whaetever you use


var sid = enviromentModel.getProperty(  "/" + window.location.hostname.toLowerCase() );

enviromentModel.setProperty("isQA", "QA" === sid );

enviromentModel.setProperty("isDEV", "DEV" === sid );


  }, this);

   enviromentModel.loadData( "systems.json" );

that.setModel(enviromentModel, "enviromentModel");

so you can use enviromentModel>/isQA  is binding

the only problem with this approcah is if the proxy is used.

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks, this issue is solved