diff --git a/api/app/lib/service/clickHouseClient.js b/api/app/lib/service/clickHouseClient.js new file mode 100644 index 0000000..fdf6490 --- /dev/null +++ b/api/app/lib/service/clickHouseClient.js @@ -0,0 +1,20 @@ +'use strict'; + +function factory (app, opts) { + if (opts.clickHouse) { + try { + for (let r of opts.clickHouse) { + if (r.name && r.root) { + app.fs[r.name] = new paasRequest(r.root, { ...(r.params || {}) }, { dataWord: r.dataWord || 'body' }) + } else { + throw 'opts.pssaRequest 参数错误!' + } + } + } catch (error) { + console.error(error) + process.exit(-1); + } + } +} + +module.exports = factory; \ No newline at end of file diff --git a/api/config.js b/api/config.js index 8e9377f..2f4e522 100644 --- a/api/config.js +++ b/api/config.js @@ -30,6 +30,11 @@ args.option('qnsk', 'qiniuSecretKey'); args.option('qnbkt', 'qiniuBucket'); args.option('qndmn', 'qiniuDomain'); +// clickHouse +args.option('clickHouseUrl', 'clickHouse Url'); +args.option('clickHousePort', 'clickHouse Port'); +args.option('clickHouseAnxincloudDB', 'clickHouse 安心云数据库名称'); + const flags = args.parse(process.argv); const POMS_DB = process.env.POMS_DB || flags.pg;