vn-rfid/util/getConfig.js

14 lines
416 B
JavaScript

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;
}