serve-lunasqu.ee/config-loader.js
2019-02-05 18:27:36 +02:00

13 lines
238 B
JavaScript

const fs = require('fs').promises
module.exports = async function (file, defaults) {
let f
try {
f = await fs.readFile(file)
f = JSON.parse(f)
} catch (e) {
return defaults
}
return Object.assign({}, defaults, f)
}