14 lines
418 B
JavaScript
14 lines
418 B
JavaScript
import mysql from 'mysql2/promise';
|
|
import yml from 'require-yml';
|
|
import path from 'path';
|
|
import fs from 'fs-extra';
|
|
|
|
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));
|
|
|
|
export default mysql.createPool(conf.db);
|
|
|