14 lines
430 B
JavaScript
14 lines
430 B
JavaScript
import yml from 'require-yml';
|
|
import path from 'path';
|
|
import fs from 'fs-extra';
|
|
|
|
export default function getConfig(env = 'local') {
|
|
const {pathname: root} = new URL('../', import.meta.url);
|
|
let conf = yml(path.join(root, 'config.yml'));
|
|
const localConfFile = path.join(root, `config.${env}.yml`);
|
|
if (fs.existsSync(localConfFile))
|
|
conf = Object.assign({}, conf, yml(localConfFile));
|
|
|
|
return conf;
|
|
}
|