serve-lunasqu.ee/config-loader.js

13 lines
238 B
JavaScript
Raw Normal View History

2019-02-05 16:27:36 +00:00
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)
}