on 10-27-2021 9:34 AM
Hi @all,
I have an action in my CAP application which is triggering a call to an external application.
The logic is using the destination service to connect to the target system.
const myApi = await cds.connect.to("MYDESTINATION");
The payload I need to send to the destination differs from runtime environment (or destination URL).
Means JSON payload (and the ID's inside it) on DEV, QA and PROD system (speparate BTP subaccounts) differs.
So I need to add a logic which is able to identify the system (or maybe the URL of the destination) to be able to prepare the right payload.
Is there any standard way to get this information?
If the data that you want to send is rarely changed and if you want to bound it to the cap application in all subaccounts and not to the destination, you can try using user-defined variables and read them inside your cap application like shown by mariusobert
https://blogs.sap.com/2020/07/23/cloud-native-lab-1-7-ways-to-define-environment-variables/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't get your issue here. Your CAP App should be deployed in 3 different subaccounts DEV, QA and PROD which then provide the same destination name, but this connection is pointing to the correspoinding backend systems. Each deployment of your app has it's own HDI Container. So your payload should already be different due to the separated persistency.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I will do an example. The destination will stay the same for DEV QA and PROD.
I need to prepare a JSON which must be send via destination service to the configured backend. The JSON will contain ID's and strings which will differ depending on the system and not persisted in my database. Persisting them could be a solution.
So on DEV the JSON looks like { guid: "123" }, for QA { guid: "129" }
I need to find a way to destingish based on the system the app is running on.
User | Count |
---|---|
75 | |
9 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.