hedgedoc/.sequelizerc.example
Philip Molares 6480c142a9
fixed usage of migrations
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:20 +02:00

31 lines
838 B
Text

var fs = require('fs');
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);
}
});
module.exports = {
'config': path.resolve('config', 'database.json'),
'migrations-path': path.resolve('lib', 'migrations'),
'models-path': path.resolve('lib', 'models')
}