s4sdk - 将环境变量目标传递给 ErpCommand
问题描述
我已经定义了一个环境变量目标,我想将用户/密码传递给 ErpCommand。我只使用带有目标名称的 ErpConfigContext 参数,当然我得到错误:无法获取当前用户:用户未通过身份验证。我的目的地是这样定义的:
目的地: | [ {“名称”:“ErpQueryEndpoint”,网址:“ https://something.s4hana.ondemand.com ”,用户名:“用户”,密码:“pass”,“forwardAuthToken”:true,属性:[{key: "TrustAll",值:"true"}]}]
如果没有 Hystrix 命令,调用就可以正常工作,我想用 Hystrix 实现相同的结果。
解决方案
Please try to also define an environment variable ALLOW_MOCKED_AUTH_HEADER
with value true
for running this locally / in non-production scenarios (or USE_MOCKED_TENANT
& USE_MOCKED_USER
).
This is needed because the Hystrix command is by default tenant and user-isolated. Alternatively, if you do not need this isolation and are fine with circuit breakers etc spanning across tenants and user, you can also modify the default Hystrix settings when defining your command by leveraging the class HystrixUtil. In the constructor of your command, use code similar to the following:
super(HystrixUtil.getDefaultErpCommandSetter(YourCommand.class)
.andCommandKey(HystrixCommandKey.Factory.asKey(
HystrixUtil.getGlobalKey(YourCommand.class))));
推荐阅读
- python - 有没有办法在熊猫数据框中的列之间动态地找到部分匹配数?
- javascript - 尝试对数据抓取进行身份验证时出现 Cookie 错误
- java - 面对异常HibernateException:实例的标识符
从 至 春天 - uwp - Xbox Series X 开发模式媒体捕获/远程查看
- python - 如何在 Python 中使用 selenium 单击按钮类
- flutter - 从一个由数字和逗号组成的字符串中返回整数列表
- node.js - 无服务器部署期间出现错误“无法读取未定义的属性‘名称’”
- checkout - 使用自托管代理解压缩时 GitHub Action 结帐失败
- c - 结构内存内容中的值是什么意思 - C
- javascript - 如何使用酶/玩笑根据图像加载返回的承诺测试内联样式更改?