How can I use a CF-defined destination during local development?

672 views Asked by At

For CAP/FaaS, can the SAP Cloud SDK be used with a destination defined on SCP CF, by means of a proxy through that destination? This would allow a single destination setup to be used for both local development as eventual cloud runtime.

https://sap.github.io/cloud-sdk/docs/js/features/connectivity/destination-js-sdk/#service-instance

I would expect there to be an example of how to provide the credentials in VCAP_SERVICES so that the Cloud SDK could access the destination instance which would provide access to the destination. However, that is not twat is being described in that section.

1

There are 1 answers

0
Junjie Tang On

First of all, the link is broken and here you can find some relevant documentation regarding destination service.

In general, when running your application locally, it is recommended to use a convenient function mockDestinationsEnv to set destination information. You can find more details here.

Of course, you can copy the VCAP environment variables from the CF and save it to your local VCAP_SERVICES to mock the runtime. But this is not recommended for some reasons. First of all, VCAP variables might contain lots of sensitive information from different services bound to your application which should be treated carefully. Secondly, it will not work for some authentication types (e.g., principal propagation related) which are using JWT. Therefore, you should never use this approach unless you are using e.g., BasicAuth so that no JWT is needed.