vn-rfid/util/getConfig.js

14 lines
416 B
JavaScript
Raw Normal View History

2023-01-24 14:10:39 +00:00
import yml from 'require-yml';
import path from 'path';
import fs from 'fs-extra';
export default function getConfig() {
const {pathname: root} = new URL('../', import.meta.url);
let conf = yml(path.join(root, 'config.yml'));
const localConfFile = path.join(root, 'config.local.yml');
if (fs.existsSync(localConfFile))
conf = Object.assign({}, conf, yml(localConfFile));
return conf;
}