Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
hc-service-client
Advanced tools
hc-service-client
本项目支持两种用法,如下介绍为在honeybee extension中使用的方法。
直接使用ServiceClient请参考: 这里 !!!
{
extension: {
serviceClient: {
module: 'hc-service-client',
config: {
otm: {
endpoint: 'http://otm.com/v2',
accessKeySecret: 'xxx',
headerExtension: ['otm']
},
azk: {
endpoint: 'http://algorithm.com/',
accessKeySecret: 'xxx',
workApp: 'test',
headerExtension: ['azk']
},
brain: {
endpoint: 'http://brain_domain.com/',
accessKeySecret: 'xxx',
headerExtension: [
function (req, serviceCfg) {
return {
'X-Access-User': req.session.id
};
}
]
}
}
}
}
}
配置详情如下。
hc-service-client的配置结构:
{
[serviceCode]: {
endpoint,
accessKeyId,
accessKeySecret,
signatureApproach,
headerExtension,
disableFileSignature,
headers,
timeout
}
}
options | desc | default |
---|---|---|
endpoint | 远程的endpoint | 必填 |
accessKeyId | 调用的用户标志 | anonymous |
accessKeySecret | 调用的签名密钥,原token/systemToken | 必填 |
signatureApproach | 签名方式 enum: [systemCall, userAuth] | 默认 systemCall |
disableFileSignature | 禁用文件签名 | false |
headerExtension | 根据环境动态修改header的扩展 | [] |
headers | 使用serviceClient的默认发送headers,优先级高于headerExtension | {} |
timeout | 请求的超时时间(单位ms) | 60000 |
signatureHeader | 签名请求头,默认 systemCall -> signature, userAuth -> Authorization |
其他参数介绍见 这里
headerExtension是一个数组,数组中元素支持动态扩展header,
支持
如:
{
otm: {
endpoint: 'http://xxx',
accessKeyId: 'DonaldTrump',
accessKeySecret: config.systemToken,
headerExtension: [
function (req, serviceCfg) {
return {
'X-Access-TenantCode': req.session.tenant || serviceCfg.defaultTenant
};
},
{
'X-Access-WorkApp': 'city_brain'
},
'otm'
]
}
}
如上配置,三个类型返回的header会merge到一起,再最终请求时带上。
const otm = req.getService('otm');
otm.get('/api/workspaces', {}, (err, data) => {});
const azk = req.getService('azk');
azk.get('/api/workspaces', {}, (err, data) => {});
FAQs
Service Client Extension for Honeybee
We found that hc-service-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.