Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use destination instead of environment variables for Cloud Foundry API credentials #7

Open
gregorwolf opened this issue Jul 5, 2021 · 1 comment

Comments

@gregorwolf
Copy link
Contributor

HI @andrewlunde,

ask you know I never liked the way how the the credentials for the Cloud Foundry API where provided in this example. I've found now the better solution: Create a destination in the SAP BTP Subaccount with the following configuration:

Screenshot 2021-07-05 at 08 53 52

The destination details can then be read using the getDestination method from @sap-cloud-sdk/core. Then you can either use cf-http-client (which does not yet support all API Endpoints). Or stick with the axios calls.

CU
Gregor

@piejanssens
Copy link

I belief nowadays you can even use @sap/cds itself for REST on a remote service (BTP destination). Either way, destinations are the way to go.

let oPayload = ...
const btpApi = await cds.connect.to("CloudFOundryAPI")
const res = btpApi.tx(req).post("/v3/routes", oPayload)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants