generated from cap-js-community/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch @cap-js-community/mtx-tool@0.10.2 for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/@cap-js-community/mtx-tool/src/context.js b/node_modules/@cap-js-community/mtx-tool/src/context.js
index 3e29916..286f385 100644
--- a/node_modules/@cap-js-community/mtx-tool/src/context.js
+++ b/node_modules/@cap-js-community/mtx-tool/src/context.js
@@ -237,7 +237,21 @@ const newContext = async ({ usePersistedCache = true, isReadonlyCommand = false
const cfBuildpack = cfApp.lifecycle?.data?.buildpacks?.[0];
const cfEnv = await _cfRequest(cfInfo, `/v3/apps/${cfApp.guid}/env`);
const [cfProcess] = await _cfRequestPaged(cfInfo, `/v3/apps/${cfApp.guid}/processes`);
- const cfEnvServices = cfEnv.system_env_json?.VCAP_SERVICES;
+ let cfEnvServices = cfEnv.system_env_json?.VCAP_SERVICES;
+ if (cfEnv.system_env_json.VCAP_SERVICES_FILE_PATH) {
+ // cf ssh <app_name> -c 'cat $VCAP_SERVICES_FILE_PATH'
+ const [stdout, stderr] = await _cfSsh(cfApp.name, { command: `cat $VCAP_SERVICES_FILE_PATH` });
+ assert(!stderr, "got stderr output from cf ssh while reading VCAP_SERVICES_FILE_PATH\n%s", stderr);
+ try {
+ cfEnvServices = JSON.parse(stdout);
+ } catch (err) {
+ return fail(
+ "caught error parsing VCAP_SERVICES_FILE_PATH content from cf ssh:\n%s\ncontent:\n%s",
+ err.message,
+ stdout
+ );
+ }
+ }
const cfEnvApp = cfEnv.application_env_json?.VCAP_APPLICATION;
const cfEnvVariables = cfEnv.environment_variables;
This issue body was partially generated by patch-package.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels