mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-27 03:58:02 -05:00
6480c142a9
Signed-off-by: Philip Molares <philip.molares@udo.edu> Signed-off-by: David Mehren <dmehren1@gmail.com>
31 lines
838 B
Text
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')
|
|
}
|