在 eggjs 中使用 qconfig.
$ npm i egg-qconfig --save
// {app_root}/config/plugin.js
exports.qconfig = {
enable: true,
package: 'egg-qconfig',
};
// {app_root}/config/config.default.js
exports.qconfig = {
// 项目名
name: '',
// 项目 token
token: '',
// 获得 token 的URL
get_token_url: '',
// 获得访问地址的URL
get_entrypoint_url: '',
// 默认5分钟
interval: '1m',
};
// 在代码中使用
// 请注意,出现错误将会抛出异常.
const content = yield app.qconfig.get('key');
Please open an issue here.