mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
测试数据上传时自动读取config
This commit is contained in:
1 parent
0d7d6ea12a
commit
4b3c10b4eb
14 files changed
+89
-42
No files matched your search
@@ -0,0 +1,19 @@
|
||||
const Zip = require('adm-zip');
|
||||
|
||||
async function readConfig(filePath) {
|
||||
const data = new Zip(filePath);
|
||||
const entries = data.getEntries();
|
||||
for (const entry of entries) {
|
||||
if (entry.name.toLowerCase() === 'config.yaml') {
|
||||
return entry.getData().toString();
|
||||
}
|
||||
if (entry.name.toLowerCase() === 'config.ini') {
|
||||
const ini = entry.getData().toString();
|
||||
const conv = global.Hydro.lib['testdata.convert.ini'];
|
||||
return conv(ini);
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
global.Hydro.lib.readConfig = module.exports = readConfig;
|
||||
Reference in new issue
Block a user