hedgedoc/.sequelizerc.example

32 lines
846 B
Text
Raw Normal View History

var fs = require('fs');
2016-10-04 22:58:05 -04:00
var path = require('path');
const envs = ['development', 'test', 'production'];
if (!fs.existsSync(path.resolve('config'))) {
fs.mkdirSync(path.resolve('config'));
}
const configJson = JSON.parse(fs.readFileSync('config.json'));
let database = {};
envs.forEach(function (env, i) {
if (configJson[env]) {
database[env] = {
...configJson[env].db
}
}
});
fs.writeFile(path.resolve('config', 'database.json'), JSON.stringify(database), 'utf8', function (err) {
if (err) {
console.log("An error occured while writing JSON Object to File.");
return console.log(err);
}
});
2016-10-04 22:58:05 -04:00
module.exports = {
'config': path.resolve('config', 'database.json'),
'migrations-path': path.resolve('src/lib', 'migrations'),
'models-path': path.resolve('src/lib', 'models')
}