【发布时间】:2020-06-17 00:12:20
【问题描述】:
在 Botium.json, "SIMPLEREST_INIT_CONTEXT": { "token": "367439234324243" ,"sessionid":"34546363dfgfg4545"}, 这个值需要取自环境变量 PROCESS.ENV.token, 我该如何设置文件,以便我可以在最简单的端点中使用它???例子会很棒
【问题讨论】:
-
我也尝试过使用带有 js 文件的 SIMPLEREST_START_HOOK,但是 botium 只是执行了钩子并停止了,没有运行任何测试
const request = require('request') var myJSONObject = json data here; module.exports = ({ context }) => {return new Promise((resolve, reject) => { request({url: "http end point here",method: "POST",json: true,headers: {"token": "0jdfhjdfho8re4545340f2"}, body: myJSONObject }, function (error, response, body){context.sessionid=response.body.message.key; context.client=response.body.client; context.token='45435634534jhj45j4j3343; })})}
标签: bots chatbot botium-box