mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-30 23:01:17 +00:00
aaff73036b
Signed-off-by: David Mehren <dmehren1@gmail.com>
31 lines
846 B
Text
31 lines
846 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('src/lib', 'migrations'),
|
|
'models-path': path.resolve('src/lib', 'models')
|
|
}
|